ageron / ageron/handson-ml2

[QUESTION] Chapter 2 - Using GridSearch result

Open
#470 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
30k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

I'm tripping up on a few things at the end of chapter 2... at the moment I'm trying to get my head around the GridSearch result.

Referring to the Jupyter notebook...

Line 94
`forest_reg = RandomForestRegressor(n_estimators=100, random_state=42)`
n_estimators = 100 which gives a result of 50,182.

Later in the text we use Grid Search to automatically change hyperparameters.
Line 99
`{'n_estimators': [3, 10, 30], 'max_features': [2, 4, 6, 8]},`
The best result is 49,682 (max_features: 8, n_estimators: 30)

If you change n_estimators on line 94 to 30 you get 50,696. It makes sense to me that its bigger than the default in line 94 but why is the result from Grid Search smaller?

I've tried changing line 99 to
`{'n_estimators': [30, 100], 'max_features': [8]},`
and this gives the results
49682.273345071546 {'max_features': 8, 'n_estimators': 30}
49219.71678391268 {'max_features': 8, 'n_estimators': 100}

My question is, what do you do with the result of the Grid Search? Why doesn't n_estimators give the same result both times? How does max_features fit in with regard to line 94?

Thank you!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.