Skip to content

Instantly share code, notes, and snippets.

@osin-vladimir
Last active November 24, 2015 10:39
Show Gist options
  • Select an option

  • Save osin-vladimir/af91fe6e358767ec8334 to your computer and use it in GitHub Desktop.

Select an option

Save osin-vladimir/af91fe6e358767ec8334 to your computer and use it in GitHub Desktop.
# set parameters for grid search
parameters_dtc = {
'max_depth': list(range(1,20)),
'criterion': ['gini', 'entropy'],
'splitter': ['best', 'random'],
'max_features' : list(range(1,15))
}
gs = GridSearchCV(DTC(), param_grid = parameters_dtc, cv = cv)
#mesure time of search
start_time = timer()
gs.fit(X, y)
time_delta = timer() - start_time
print("Best score: %s" % gs.best_score_)
print ("Best parameters: %s" % gs.best_params_)
print("Time of grid search: ", time_delta)
print("Accuracy metric: ", compute_accuracy(X,y,gs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment