Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyper-parameter Tuning of Data preparation steps #590

Open
amritvirsinghx opened this issue Sep 6, 2020 · 0 comments
Open

Hyper-parameter Tuning of Data preparation steps #590

amritvirsinghx opened this issue Sep 6, 2020 · 0 comments

Comments

@amritvirsinghx
Copy link

amritvirsinghx commented Sep 6, 2020

Hi,
In the book, it is mention that we can use some of the data preparation steps as hyper parameters eg add_bedrooms_per_room can be hyperparameter

I tried putting it directly in the GridSearchCV, but it gives an error.

from sklearn.model_selection import GridSearchCV
param_grid={
    'n_estimators':[3,10,30],'max_features':[2,4,6,8],
    'bootstrap':[False,True],'n_estimators':[3,10],'max_features':[2,3,4],
    'add_bedrooms_per_room':[True,False]
}

forest_reg=RandomForestRegressor()
grid_serach=GridSearchCV(forest_reg,param_grid,cv=5,scoring="neg_mean_squared_error")
grid_serach.fit(housing_prepared,housing_labels)

Can you please explain how to do it? and I want to tune this 'add_bedrooms_per_room':[True,False] and also use GridSearchCV to find out what can be the best strategy to fill missing values when we pass 'stategy':["mean","median"] etc

Please explain it using this example only:
https://github.com/ageron/handson-ml/blob/master/02_end_to_end_machine_learning_project.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant