Skip to Content
Hands-On Machine Learning for Algorithmic Trading
book

Hands-On Machine Learning for Algorithmic Trading

by Stefan Jansen
December 2018
Beginner to intermediate
684 pages
21h 9m
English
Packt Publishing
Content preview from Hands-On Machine Learning for Algorithmic Trading

How to tune parameters with GridSearchCV

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Machine Learning for Algorithmic Trading - Second Edition

Machine Learning for Algorithmic Trading - Second Edition

Stefan Jansen

Publisher Resources

ISBN: 9781789346411Supplemental Content