admin管理员组文章数量:1650772
👦👦一个帅气的boy,你可以叫我Love And Program
🖱 ⌨个人主页:Love And Program的个人主页
💖💖如果对你有帮助的话希望三连💨💨支持一下博主
UserWarning: X has feature names, but LassoCV was fitted without feature names
在使用sklearn过程中程序出现如上报错,说明咱们输入时没有用Dataframe作为模型的训练集
只需要将训练数据改成如下形式即可(我是将array转换成Dataframe格式):
DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().
DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().
在数据拟合过程中fit()
出现数据转换的问题,提示使用ravel()
函数,转换前是二维数组的形式,如下图:
y_train
转换后变成一维数组,警告消失,但是对结果影响不大
y_train.ravel()
# 或
np.array(y_train).reshape(1,-1)[0]
本文标签: 报错UserWarningskleaenfeaturefitted
版权声明:本文标题:skleaen报错UserWarning: X has feature names, but LassoCV was fitted without feature names 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1729530995a1204802.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论