I am trying to return the coefficients of my logistic regression model. Here is how I created my model:
logreg = LogisticRegression(solver = 'liblinear')
model = GridSearchCV(logreg, cv = 3, param_grid = {
'penalty': ('l1', 'l2'),
'C': [0.5, 0.6, 0.7, 0.8, 0.9],
'max_iter': [100]
})
model.fit(X_train, y_train)
model.coef_ # here is where I get the error
# Validation (test)
y_pred = model.predict(X_test)
But I get the following error:
AttributeError: 'GridSearchCV' object has no attribute 'coef_'
I even tried the .best_score_ and other functions to see if I could find the coefficients in another way. But no luck. Do you know how I can fix this?