How it works...

Vectors are mathematical artifacts that allow us to express magnitude and direction. In machine learning, we collect object/user preferences into vectors and matrices in order to take advantage of distributed operations at scale.

Vectors are tuples of numbers usually corresponding to some attributes collected for machine learning algorithms. The vectors are usually real numbers (measured values), but many times we use binary values to show the presence or absence of a preference or bias for a particular topic.

A vector can be thought of as either a row vector or a column vector. The column vector presentation is more suitable for ML thinking. The column vector is represented as follows:

The row vector is represented as follows: ...

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.