from sklearn import neighbors
from sklearn import datasets knn = neighbors.KNeighborsClassifier() iris = datasets.load_iris() print (iris) knn.fit(iris.data, iris.target) predictedLabel = knn.predict([[0.1, 0.2, 0.3, 0.4]])
print ("niu")
print (predictedLabel)

Knn:Knn实现对150朵共三种花的实例的萼片长度、宽,花瓣长、宽数据统计,根据一朵新花的四个特征来预测其种类-LMLPHP

05-08 08:32