训练测试拆分法得到的数值错误

问题描述 投票:0回答:1

这是我的代码

 X_train , X_test,  y_train, y_test = train_test_split(X, y, test_size=0.4, random_state=101)

这是我得到了什么

ValueError: Found input variables with inconsistent numbers of samples: [7, 5000]

我不知道发生了什么事,我试着把它运行一遍又一遍,结果就这样了

python python-3.x scikit-learn linear-regression
1个回答
0
投票

你的矩阵是什么形状的?看起来,那 Xy 有不同的长度。检查它与 print(X.shape, y.shape)

© www.soinside.com 2019 - 2024. All rights reserved.