Skip to content

Instantly share code, notes, and snippets.

@mprzybyla123
Created June 23, 2020 00:58
Show Gist options
  • Save mprzybyla123/663dfc57b5cf6fcdd45b4a06ce82afb3 to your computer and use it in GitHub Desktop.
Save mprzybyla123/663dfc57b5cf6fcdd45b4a06ce82afb3 to your computer and use it in GitHub Desktop.
grid-search
# unite the features and classifier together
pipe = Pipeline([('features', features),
('clf',clf)
])
# create grid
param_grid = {
'n_estimators': [200, 300, 400],
'max_features': ['auto', 'sqrt', 'log2'],
'max_depth' : [4,6,8,10,20],
'criterion' :['gini', 'entropy']
}
# apply grid to model
search = GridSearchCV(pipe, param_grid, cv=2).fit(X, y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment