标签:ase import datasets learn ict class 预测 ext iris
import numpy as np
from sklearn import datasets
from sklearn.neighbors import KNeighborsClassifier
np.random.seed(0)
iris = datasets.load_iris()
x = iris.data
y = iris.target
i = np.random.permutation(len(iris.data))
x_train = x[i[:-10]]
y_train = y[i[:-10]]
x_text = x[i[-10:]]
y_text = y[i[-10:]]
knn = KNeighborsClassifier()
knn.fit(x_train,y_train)
knn.predict(x_text)
y_text
标签:ase import datasets learn ict class 预测 ext iris
原文地址:https://www.cnblogs.com/wei23/p/13127278.html