我将为工作提供快速演示,并且我在前面准备的代码中遇到此错误消息:
“//水蟒/ LIB / python3.6 /站点包/ sklearn / utils的/ validation.py:395: 弃用警告:传递1d数组作为数据在0.17中弃用 并将在0.19中引发ValueError。使用重塑您的数据 X.reshape(-1,1)如果您的数据有单个特征或X.reshape(1,-1) 如果它包含单个样本。 DeprecationWarning)“
这是我的代码:
from sklearn.cross_validation import train_test_split
from sklearn import tree
x = ml_list # This variable will refer to your features
y = labels # This variable will refer to your labels
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.5)
#Evaluating Decision Tree Classifier
my_classifier_tree = tree.DecisionTreeClassifier()
my_classifier_tree.fit(x_train, y_train)
predictions_tree = my_classifier_tree.predict(x_test)
print(predictions_tree)
我该怎么做让我的代码再次运行?