There's more...

The linear model does alright at its first attempt, but if we want our model to be more accurate, we will have to use a more complex model with some non-linearities in order to fit well to all the data points. XGBoost is the model we will be using in this section in order to try and improve the accuracy obtained through linear regression. This is done in the following manner:

  1. Import the XGBoost library using the import xgboost command.
  2. In case this produces an error, you will have to do a pip install of the library through the terminal. This can be done by opening up a new terminal window and issuing the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ...

Get Apache Spark Deep 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.