Vectors

A base class of vectors supports both dense and sparse vectors. The fundamental difference is the efficiency of presentation for data structures with sparsity. The dense vector is the choice here, since the training data is all meaningful per row and very little sparsity is present. In the cases where we deal with sparse vectors, matrices, and so on, the sparse tuple will contain the index and corresponding values at the same time.

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.