验证码: 看不清楚,换一张 查询 注册会员,免验证
  • {{ basic.site_slogan }}
  • 打开微信扫一扫,
    您还可以在这里找到我们哟

    关注我们

如何解决ValueError: Supported target types are:('binary', 'multiclass'). Got 'c

阅读:832 来源:乙速云 作者:代码code

如何解决ValueError: Supported target types are:('binary', 'multiclass'). Got 'c

解决问题

问题背景如下:

SKFold = StratifiedKFold(n_splits=cv_i,shuffle=True,random_state=123)

解决思路

值错误:支持的目标类型为:('binary', 'multiclass'),需要用“continuous”替代。

解决方法

stratify只处理分类任务问题,对于回归任务,采用以下问题解决

from sklearn.model_selection import KFold,StratifiedKFold
n_SKFold = StratifiedKFold(n_splits=cv_i,shuffle=True,random_state=123)

替换为

from sklearn.model_selection import KFold,StratifiedKFold
n_SKFold = KFold(n_splits=n_folds ,shuffle=True,random_state=123)
分享到:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: hlamps#outlook.com (#换成@)。
相关文章
{{ v.title }}
{{ v.description||(cleanHtml(v.content)).substr(0,100)+'···' }}
你可能感兴趣
推荐阅读 更多>