April 2016
Beginner to intermediate
384 pages
8h 36m
English
Previously, we used decision trees to classify our bank contact calls (refer to the Classifying calls with decision trees recipe from Chapter 3, Classification Techniques). Classification and regression trees are the equivalent methods applied to regression problems.
To execute this recipe, you need pandas and Scikit. No other prerequisites are required.
Estimating CART with Scikit is extremely easy (the regression_cart.py file):
import sklearn.tree as sk @hlp.timeit def regression_cart(x,y): ''' Estimate a CART regressor ''' # create the regressor object cart = sk.DecisionTreeRegressor(min_samples_split=80, max_features="auto", random_state=666666, max_depth=5) # estimate ...
Read now
Unlock full access