做一个机器学习的课程,我想把数据分成训练集和测试集。我想把它分开,用Decisiontree进行训练,然后打印出我的测试集的分数。给出了代码中的交叉验证参数。有人看到我做错什么了吗?在
我得到的错误是:
Traceback (most recent call last):
File "/home/stephan/ud120-projects/validation/validate_poi.py", line 36, in <module>
clf = clf.fit(features_train, labels_train)
File "/home/stephan/.local/lib/python2.7/site-packages/sklearn/tree/tree.py", line 221, in fit
"number of samples=%d" % (len(y), n_samples))
ValueError: Number of labels=29 does not match number of samples=66
这是我的代码:
^{pr2}$
您需要通过列车分割功能中的测试_size=0.5
您的变量似乎与^{} 的返回模式不匹配
尝试:
相关问题 更多 >
编程相关推荐