Skip to content

Commit

Permalink
Add comment on overfitting for random forests
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturoAmorQ committed Feb 9, 2024
1 parent 66fde39 commit b156bc3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python_scripts/ensemble_sol_02.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,10 @@

plt.plot(data_range[feature_name], forest_predictions, label="Random forest")
_ = plt.legend(bbox_to_anchor=(1.05, 0.8), loc="upper left")

# %% [markdown] tags=["solution"]
# The random forest reduces the overfitting of the individual trees but still
# overfits itself. In the section on "hyperparameter tuning with ensemble
# methods" we will see how to further mitigate this effect. Still, interested
# users may increase the number of estimators in the forest and try different
# values of, e.g., `min_samples_split`.

0 comments on commit b156bc3

Please sign in to comment.