From the course: NLP with Python for Machine Learning Essential Training

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Random forest model with grid search

Random forest model with grid search

- [Instructor] This lesson is going to build on what we learned in the last lesson, but we'll introduce a new concept, called grid-search. In the last lesson, we fit just a single model with a single set of hyperparameter settings, and then we generated a single set of evaluation metrics. But aren't you a little curious to see if we can maybe make our model better, simply by changing the hyperparameter settings, like the number of estimators, or the max depth? We mentioned the last model wasn't quite aggressive enough. Could we capture more spam by altering the hyperparameter settings? That's where grid-search comes in. Grid-search basically means defining a grid of hyperparameter settings, and then exploring a model fit with each combination of those hyperparameter settings. So in our case, that means setting a range of number of estimators, and a range of max depth, that you'd like to explore. And then grid-search will test every combination of those, and fit a model and evaluate…

Contents