May 2019
Intermediate to advanced
162 pages
4h 24m
English
Now let's see how a regression tree can perform. We walked through the same exact implementation of our regression tree, except we're going to use the variance reduction. Rather than using the mode voting here for producing predictions, we're going to use the mean.
Inside the examples directory, we have the example_regression_decision_tree.py file. So, here we will import CARTRegressor and use mean_squared_error as our loss function to determine how well we did:
from packtml.decision_tree import CARTRegressorfrom sklearn.metrics import mean_squared_errorfrom sklearn.model_selection import train_test_splitimport matplotlib.pyplot as pltimport numpy as npimport sys
We will just create random values here in a sine wave. That's ...
Read now
Unlock full access