Creating SparseVector and setup with Spark

In this recipe, we examine several types of SparseVector creation. As the length of the vector increases (millions) and the density remains low (few non-zero members), then sparse representation becomes more and more advantageous over the DenseVector.

Get Apache Spark 2.x Machine Learning Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.