[ https://issues.apache.org/jira/browse/SPARK-6244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14356464#comment-14356464 ]
Sean Owen commented on SPARK-6244: ---------------------------------- You can reuse this JIRA but you would have to modify the title and description. You should close your PR and make a new one. At best we are talking about adding a few utility methods to {{Vectors}}, but what is the use case for these? yes, I can imagine some, but would it refactor some repeated usages in the code? I don't think MLlib intends to contain a full suite of vector utility methods as that is what Breeze is used for. I'd rather not add utility code just for its own sake. But if there's a clear common use for these things it could make sense. > Implement VectorSpace to easy create a complicated feature vector > ----------------------------------------------------------------- > > Key: SPARK-6244 > URL: https://issues.apache.org/jira/browse/SPARK-6244 > Project: Spark > Issue Type: New Feature > Components: MLlib > Reporter: Kirill A. Korinskiy > Priority: Minor > > VectorSpace is wrapper what implement three operation: > - concat -- concat all vectors to single vector > - sum -- sum of vectors > - scaled -- multiple scalar to vector > > Example of usage: > ``` > import org.apache.spark.mllib.linalg.Vectors > import org.apache.spark.mllib.linalg.VectorSpace > // Create a new Vector Space with one dense vector. > val vs = VectorSpace.create(Vectors.dense(1.0, 0.0, 3.0)) > // Add a to vector space a scaled vector space > val vs2 = vs.add(vs.scaled(-1d)) > // concat vectors from vector space, result: Vectors.dense(1.0, 0.0, 3.0, > -1.0, 0.0, -3.0) > val concat = vs2.concat > // take a sum from vector space, result: Vectors.dense(0.0, 0.0, 0.0) > val sum = vs2.sum > ``` > This wrapper is very useful when create a complicated feature vector from > structured objects. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org