Grid Search Using Logistic Regression

Learn how to apply the grid search method to find the best hyperparameters for a logistic regression model.

A practical example of a grid search method

This example shows how we can use the grid search method to optimize the hyperparameters of the ML model.

In this example, we’ll use the logistic regression algorithm to determine which combination of hyperparameter values will produce the best results compared to using the default values for the hyperparameters.

What will we learn?

In this lesson, we’ll learn how to do the following things in the Jupyter Notebook:

  • Create and train an ML model (logistic regression).

  • Measure the performance of the ML model.

  • Perform the steps required to implement the grid search method.

  • Identify the combination of hyperparameters that provide the best results.

Import important packages

First, we import the important Python packages that will do the following tasks:

  • Create and train an ML model (logistic regression).

  • Check the ML model’s performance.

  • Implement the grid search method.

  • Identify the combination of hyperparameters that provide the best results.

Get hands-on with 1200+ tech skills courses.