Hyperparameter Grid Workout 2
- 02:27
How to create hyperparameter grids for random forest and gradient boosting models.
Downloads
No associated resources to download.
Transcript
You're going to create hyperparameter grids for your random forest model and your gradient boosting model. First, create a hyperparameter grid named RF hyperparameters with two items. The key for the first item is random forest regressor, double underscore in underscore estimators, and that's the number of decision trees. The value is going to be a list containing the objects 100 and 200 for the second item, the key is random forest regressor, double underscore max underscore features, and the value is a list containing the string auto and then the float object 0.3 and 0.6, and that tells the model how many features it's allowed to use out of all of the features in your dataset, which prevents overfitting.
Next, create a hyperparameter grid named GB hyper parameters, which will have three items for the first item. The key is gradient boosting regressor double underscore in single underscore estimators, and the value is a list containing 100 and 200. For the second item, the key is gradient boosting regressor double underscore learning underscore rate, and the value is a list containing 0.05, 0.1, and 0.2 for the final item. The key is gradient boosting regressor, double underscore max depth, and the value is a list containing the integers 1, 3, and 5. Pause the video now and create both of those hyper parameter grids.
For your random forest dictionary, you're gonna start with the number of estimators hyperparameter in underscore estimators, and that's gonna contain a list with these values. Then the max features hyper parameter containing a list of these values.
Remember that there's a double underscore here and a double underscore here. For the gradient boosting grid. It's also going to have a number of estimators, hyperparameter, containing the values that you see here, but it's also going to have a learning rate, hyper parameter containing these values and a maximum depth hyperparameter containing these values. Once you execute that cell, you're going to have a hyperparameter grid for all 5 of your model classes.