from sklearn.metrics import f1_score, make_scorer
from sklearn.model_selection import GridSearchCV, StratifiedKFold
param_grid = [
{
‘est__C’: [0.5, 0.75, 1, 1.5, 2, 3],
‘est__kernel’: [‘rbf’], # others does not work, already tried
‘est__gamma’: [‘scale’, ‘auto’, 0.05, 0.01]
},
]
full_pipeline = Pipeline(
\[('prep', full_preprocessing),
('est', SVC(random_state=42, class_weight='balanced'))\]
)
skf = StratifiedKFold(shuffle=True, random_state=42)
gscv = GridSearchCV(estimator = full_pipeline, param_grid = param_grid, scoring=‘f1_macro’, cv = skf, verbose=3)