This is the code used run the gridsearch.
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import precision_score, recall_score, make_scorer
grid = GridSearchCV(
estimator=LogisticRegression(max_iter=1000),
param_grid={'class_weight': [{0: 1, 1: v} for v in range(1, 4)]},
cv=4,
n_jobs=-1
)
grid.fit(X, y);
This is the code to view the results.
pd.DataFrame(grid.cv_results_)