The grid search part of my code looks like this:
svc_param_grid={"C":c, "kernel":kernel, "gamma":gamma, "degree":degree}
grid_cv_object = GridSearchCV(
estimator=SVC(),
param_grid=svc_param_grid,
n_jobs=-1,
verbose=3,
cv=k_fold,
# a callable that returns a single value
scoring=make_scorer(matthews_corrcoef)
)
It is used for multi-class classification (predicting protein secondary structure sequence).
Why am I getting this error and is there a workaround?
/usr/local/anaconda3/lib/python3.8/site-packages/sklearn/metrics/_classification.py:873: RuntimeWarning: invalid value encountered in double_scalars
mcc = cov_ytyp / np.sqrt(cov_ytyt * cov_ypyp)
You are experiencing this issue, which was fixed in this pull request, after the 0.24.2 release.
The warning is caused by a division-by-zero due to no variance in your predictions. It is misleading and can be ignored; the metric is correctly returning zero.