From the course: Supervised Learning Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Searching for the best model

Searching for the best model - Python Tutorial

From the course: Supervised Learning Essential Training

Start my 1-month free trial

Searching for the best model

- [Instructor] Continuing with our evaluation metrics from the last video, let's explore search techniques to help us get to the best value for K, and for other modeling techniques, the other parameters that help us achieve the best results. We can use the sklearn library to import both grid search and random search. Both of these methods are used to help us find the best value for K, and that's to create a model that generalizes well. Grid search performs an exhaustive search over specified parameter values for an estimator. The parameters of the estimator used to apply these methods are optimized by cross-validated grid search over a parameter grid. By creating a model using grid search, we can output the best parameters using the best params attribute of our model. Let's see that in action. First let's load all of our libraries and do the same steps as we have to load in our data, prepare it, and create our basic…

Contents