How to do it...

  1. We use a housing data set from the UCI machine library depository.
  1. Download the entire data set from the following URLs:

The dataset is comprised of 14 columns with the first 13 columns being the independent variables (that is, features) that try to explain the median price (that is, 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:

    • CRIM: Per capita crime rate by town
    • ZN: Proportion of residential land zoned for lots over 25,000 sq.ft.
    • INDUS: Proportion of non-retail ...

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.