September 2019
Intermediate to advanced
420 pages
10h 29m
English
Similarly, we can use the BaggingRegressor class to form an ensemble of regressors.
For example, we could build an ensemble of decision trees to predict housing prices from the Boston dataset of Chapter 3, First Steps in Supervised Learning.
In the following steps, you will learn how to use a bagging regressor for forming an ensemble of regressors:
In [7]: from sklearn.ensemble import BaggingRegressor... from sklearn.tree import DecisionTreeRegressor... bag_tree = BaggingRegressor(DecisionTreeRegressor(),... max_features=0.5, n_estimators=10, ... random_state=3)
Read now
Unlock full access