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
Post a Comment