Evan Lutins
Sep 6, 2017 · 2 min read

Grid-searching is the process of scanning the data to configure optimal parameters for a given model. Depending on the type of model utilized, certain parameters are necessary. Grid-searching does NOT only apply to one model type. Grid-searching can be applied across machine learning to calculate the best parameters to use for any given model. It is important to note that Grid-searching can be extremely computationally expensive and may take your machine quite a long time to run. Grid-Search will build a model on each parameter combination possible. It iterates through every parameter combination and stores a model for each combination. Without further ado, lets jump into some examples and implementation.

For the sake of this article I will utilize Decision Trees to explain and implement Grid-Searching in Python.


Importing the necessary libraries

Instantiating the model

Establishing which parameters to Grid Search

Running the Grid Search. This step may take a long time to run depending on the data and number of parameters.

Fitting the Grid Search


Methods to Run on Grid-Search

Evan Lutins

Written by

Recent graduate from the University of Maryland and current Data Scientist.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade