GitHub user catap opened a pull request:

    https://github.com/apache/spark/pull/4962

    [SPARK-6244] Implement VectorSpace to easy create a complicated feature 
vector

    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.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/catap/spark vector_space

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/4962.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #4962
    
----
commit 14417c64a4fe63df60536b5252a2d0fee51184f0
Author: Kirill A. Korinskiy <[email protected]>
Date:   2015-03-10T11:57:28Z

    [SPARK-6244] Implement VectorSpace to easy create a complicated feature 
vector
    
    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.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to