【发布时间】:2021-03-27 18:54:15
【问题描述】:
我有两个文件,即 data [3806, 2] 和 target [4039, 2]。我的目标是将这些文件拆分为训练和测试数据集。我已经尝试过:
from sklearn.model_selection import train_test_split
data_train, data_test, target_train, target_test = train_test_split(data, target, test_size=0.2, random_state=0)
但是,它给出了错误:
ValueError: Found input variables with inconsistent numbers of samples: [3806, 4039]
为了运行分类算法,该问题的最佳解决方案是什么?
【问题讨论】:
标签: classification text-classification supervised-learning