LogisticRegressionCV
LogisticRegressionCV
is a class that implements cross-validation inside it. This class will train multiple LogisticRegression
models and return the best one.
Exercise 7.06: Training a Logistic Regression Model Using Cross-Validation
The goal of this exercise is to train a logistic regression model using cross-validation and get the optimal R2 result. We will be making use of the Cars dataset that you worked with previously.
The following steps will help you complete the exercise:
- Open a new Colab notebook.
- Import the necessary libraries:
# import libraries import pandas as pd from sklearn.model_selection import train_test_split
In this step, you import
pandas
and alias it aspd
. You will make use of pandas to read in the file you will be working with. - Create headers for the data:
# data doesn't have headers, so let's create headers _headers = ['buying', 'maint', 'doors', 'persons', \ ...