【问题标题】:I got value error from train test split method我从训练测试拆分方法中得到值错误
【发布时间】:2020-09-09 00:27:14
【问题描述】:

这是我的代码

 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】:

您的矩阵有哪些形状?似乎,Xy 的长度不同。
print(X.shape, y.shape)检查一下

【讨论】:

    猜你喜欢
    • 2021-09-20
    • 2021-06-28
    • 2018-12-21
    • 1970-01-01
    • 1970-01-01
    • 2020-10-25
    • 2019-09-11
    • 2017-11-01
    • 2019-07-21
    相关资源
    最近更新 更多