How it works...

A matrix can be thought of as columns of vectors. Matrices are the power tools for distributed computation involving linear algebra transformation. A variety of attributes or feature representation can be collected and operated upon via matrices.

In short, matrices are two-dimensional m x n arrays of numbers (usually real numbers) whose elements can be referenced using a two-element subscript, i and j:

A matrix is represented as follows:

A matrix transpose is represented as follows:

Matrix multiplication 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.