How to do it...

  1. We use a housing dataset from the UCI machine library depository. You can download the entire dataset from the following URL:

https://archive.ics.uci.edu/ml/machine-learning-databases/housing/

The dataset comprises 14 columns with the first 13 columns being the independent variables (features) that try to explain the median price (last column) of an owner-occupied house in Boston, USA.

We have chosen and cleaned the first eight columns as features. We use the first 200 rows to train and predict the median price:

  1. Start a new project in IntelliJ or in an IDE of your choice. Make sure that the necessary JAR files are included. ...

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.