sklearn.neighbors 模块中使用 KNeighborsClassifier
from sklearn.neighbors import KNeighborsClassifierX = [[0], [1], [2], [3], [4], [5], [6], [7], [8]]y = [0, 0, 0, 1, 1, 1, 2, 2, 2]neigh = KNeighborsClassifier(n_neighbors=3)neigh.fit(X, y)#fit...