Skip to content

Instantly share code, notes, and snippets.

@chyld
Created March 1, 2022 16:08
Show Gist options
  • Save chyld/110a5d23214043bb2a0a866bd3e837c0 to your computer and use it in GitHub Desktop.
Save chyld/110a5d23214043bb2a0a866bd3e837c0 to your computer and use it in GitHub Desktop.
parameters = {'criterion': ['entropy', 'gini'],
'max_depth': range(1, 20),
'min_samples_split': range(2, 10),
'max_features': ['sqrt', 'log2', None]
}
model = DecisionTreeClassifier()
gs = GridSearchCV(model, parameters, cv=5, n_jobs=-1, verbose=1)
gs.fit(X_train, y_train)
gs.best_score_, gs.best_params_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment