Back to questions
JuniorTheoryCommon
What does this program print?
from sklearn.datasets import load_diabetes
from sklearn.ensemble import HistGradientBoostingRegressor
X, y = load_diabetes(return_X_y=True)
model = HistGradientBoostingRegressor(max_iter=300, random_state=0)
model.fit(X, y)
print(model.n_iter_)300
- Expecting fewer than
300trees, as if early stopping were on: the defaultearly_stopping="auto"turns it on only above 10,000 rows, andload_diabeteshas 442. - Expecting
10fromn_iter_no_change=10: that is how many trees without improvement stop training, whilen_iter_counts the trees actually built.
- What changes in the output if
early_stopping=Trueis passed, and which rows does the model then hold out? - Why is the test set never used to decide when boosting stops?