Skip to content

Optimization using GridSearchCV

Ananyeah edited this page Mar 15, 2018 · 1 revision

2018-W-450-4/08-gridsearch_hyperparameters-lesson/optimization-gridsearch-lesson-solution

GridSearchCV

gs = GridSearchCV(LogisticReg(), param_grid) param_grid(param 1 : (val1, val2, val3), param2= (val1...))

param_grid is a dictionary of params

CV - Cross Validation, So if we gave cv a value of 5, it would split the train into 5 parts. Train four of it and test with the fifth.

Best way to do CV is LOO (Leave one out)

.fit() - to find the best hyper parameter .score() - Scores on the test set .predict() - Predicts on validation or real data.

ShuffleSplit

To make sure the split on the CV is randomly distributed?

StratifiedShuffleSplit

Clone this wiki locally