运行项目时出现上述错误,但我不确定为什么。代码如下:
X = IrisData.iloc[:,[0,1,2,3]].values
Y = IrisData.iloc[:,[4]].values
from sklearn.model_selection import train_test_split
X_TrainSet, X_TestSet, Y_TrainSet, Y_TestSet = train_test_split(X, Y)
from sklearn.neighbors import KNeighborsClassifier
ForClassification = KNeighborsClassifier(n_neighbors=6)
ForClassification.fit(X_TrainSet, Y_TrainSet)
Running the last set, I get this error:
DataConversionWarning:当期望1d数组时,传递了列向量y。请从sys.path中删除cwd之后,例如使用ravel()将y的形状更改为(n_samples,)。
似乎可以产生结果,但是可以继续吗?