penalty = ['l1', 'l2']
C = np.logspace(0, 4, 10)
grid_model = GridSearchCV(log_model, param_grid={'C':C, 'penalty':penalty})
grid_model.fit(scaled_X_train, y_train)
I was getting the error in the last line.
I was expecting it to fit the training data but got an error. Is it due to something which happened while creating the categorical column from a numeric one?
Ensure that there are no missing values (None or NaN) in your training data (
scaled_X_trainandy_train).You can use the following to check for missing values:
If you find missing values, handle them appropriately, either by imputing or removing them.
Additionally, make sure your categorical column conversion is done correctly and that all features are in a compatible format for logistic regression.