Hyperparameter Tuning
- 01:13
Understand hyperparameter tuning for classification algorithms, including logistic regression, random forest, and gradient boosting classifiers, focusing on the creation of hyperparameter grids for cross-validation.
Downloads
No associated resources to download.
Transcript
Hyperparameter tuning for your classification algorithm will be very similar to your regression algorithm. For the logistic regression classifier, you'll tune the L1 and L2 penalty factors, which in this case are called C instead of alpha. For the random forest classifier, you'll tune the number of strong learners and the maximum number of features.
For the gradient boosting classifier. You'll tune the number of weak learners, the learning rate, and the maximum depth of each decision tree.
Like your regression algorithm, you'll create a dictionary of hyperparameters and alternative values to test for each model, which is called the hyperparameter grid. Then group all hyperparameter grids into a new dictionary, which will be used during the cross validation process. And remember, new keys must match the keys in the pipeline's dictionary. The format will match your regression algorithm. If you need to use that regression algorithm code as reference, be careful not to miss the double underscore in each hyperparameter name. The hyperparameter names are already written in the Scikit Learn package, and so they must match exactly for your hyperparameter tuning process to work correctly.