Home | Trees | Indices | Help |
|
---|
|
object --+ | Vectors
Factory methods for working with vectors. Note that dense vectors are
simply represented as NumPy array objects, so there is no need to covert
them for use in MLlib. For sparse vectors, the factory methods in this
class create an MLlib-compatible type, or users can pass in SciPy's
scipy.sparse
column vectors.
Instance Methods | |
Inherited from |
Static Methods | |||
|
|||
|
Properties | |
Inherited from |
Method Details |
Create a sparse vector, using either a dictionary, a list of (index, value) pairs, or two separate arrays of indices and values (sorted by index). @param size: Size of the vector. @param args: Non-zero entries, as a dictionary, list of tupes, or two sorted lists containing indices and values. >>> print Vectors.sparse(4, {1: 1.0, 3: 5.5}) [1: 1.0, 3: 5.5] >>> print Vectors.sparse(4, [(1, 1.0), (3, 5.5)]) [1: 1.0, 3: 5.5] >>> print Vectors.sparse(4, [1, 3], [1.0, 5.5]) [1: 1.0, 3: 5.5] |
Create a dense vector of 64-bit floats from a Python list. Always returns a NumPy array. >>> Vectors.dense([1, 2, 3]) array([ 1., 2., 3.]) |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Jul 4 18:52:26 2014 | http://epydoc.sourceforge.net |