警告这似乎是 Matthews 相关系数计算中的错误

Warning that seems a bug in Matthews correlation coefficient computation

我的代码的网格搜索部分如下所示:

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)
)

用于多class class化(预测蛋白质二级结构序列)

为什么我会收到此错误,是否有解决方法?

/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)

在 0.24.2 版本发布后,您遇到了 this issue, which was fixed in this pull request

警告是由 division-by-zero 引起的,因为您的预测没有差异。它具有误导性,可以忽略;指标正确返回零。