June 2020
Intermediate to advanced
382 pages
11h 39m
English
In this section, we will see how a regression tree algorithm can be used for the regressors challenge:
First, we train the model using a regression tree algorithm:

Once the regression tree model is trained, we use the trained model to predict the values:
y_pred = regressor.predict(X_test)
Then, we calculate RMSE to quantify the performance of the model:
from sklearn.metrics import mean_squared_errorfrom math import sqrtsqrt(mean_squared_error(y_test, y_pred))
We get the following output: