scala - How do I normalize org.apache.spark.mllib.linalg.Vectors? -


it pretty easy normalize vectors in scala (scala.collection.immutable.vector) using map:

val w = vector(3,4,5) /** l1 norm: **/ val w_normalized = w.map { _/w.sum } 

but can't perform same thing org.apache.spark.mllib.linalg.vector: if try it, error:

error: value map not member of org.apache.spark.mllib.linalg.vector 

so, way normalize spark vectors?


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -