Table of Contents
Spark - Sparse Vector
Example
sparse1 = SparseVector(4, [1, 3], [3.0, 4.0])
where:
4 is the size of the vector
[1,3] are the
ordered
indices of the vector where the data is not null
[3,4] are the value
The sparse1 vector = [0,3,0,4]
Documentation / Reference
https://spark.apache.org/docs/latest/api/python/pyspark.mllib.html?highlight=sparsevector#pyspark.mllib.linalg.SparseVector