成功解决ValueError: Found input variables with inconsistent numbers of samples: [200000, 150000]

解决问题

ValueError: Found input variables with inconsistent numbers of samples: [86, 891]

在这里插入图片描述

解决思路

值错误:发现输入参数变量与样本数不一致:[200000,150000]。我们可以输出参数变量的形状查看,发现的确不一致,找到了问题的根源!

print(X_train.shape)
print(y_train.shape)

(200000, 32)
(150000,)
在这里插入图片描述

解决方法

对问题进行改进,使结果长度保持一致即可,输出结果查看

print(X_train.shape)
print(X_test.shape)
 
(150000, 32)
(150000,)
发布了786 篇原创文章 · 获赞 1121 · 访问量 15万+

猜你喜欢

转载自blog.csdn.net/qq_35456045/article/details/104956134