There's more...

A LabeledPoint is a popular structure used to package data as a Vector + a Label which can be purposed for supervised machine learning algorithms. A typical layout of the LabeledPoint is given here:

Seq( 
LabeledPoint (Label, Vector(data, data, data)) 
...... 
LabeledPoint (Label, Vector(data, data, data)) 
) 

Please note that not only dense but also sparse vectors can be used with LabeledPoint, which will make a huge difference in efficiency especially if you have a large and sparse dataset housed in the driver during testing and development.

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.