December 2018
Beginner to intermediate
684 pages
21h 9m
English
The GridSearchCV class in the model_selection module facilitates the systematic evaluation of all combinations of the hyperparameter values that we would like to test. In the following code, we will illustrate this functionality for seven tuning parameters that when defined will result in a total of 24 x 32 x 4 = 576 different model configurations:
cv = OneStepTimeSeriesSplit(n_splits=12)param_grid = dict( n_estimators=[100, 300], learning_rate=[.01, .1, .2], max_depth=list(range(3, 13, 3)), subsample=[.8, 1], min_samples_split=[10, 50], min_impurity_decrease=[0, .01], max_features=['sqrt', .8, 1])
The .fit() method executes the cross-validation using the custom OneStepTimeSeriesSplit and the roc_auc ...