标签:查看 names port span hid cli isp import bsp
from sklearn.model_selection import train_test_split from sklearn.datasets import load_iris from sklearn.neighbors import KNeighborsClassifier import numpy as np cheng = load_iris() # print(cheng.keys()) # print(cheng.data) # print(cheng.target) # print(cheng.target_names) # print(cheng.DESCR) # print(cheng.feature_names) # print(cheng.filename) trainX, testX, trainY, tesY = train_test_split( cheng.data, cheng.target, random_state=0) knn = KNeighborsClassifier(n_neighbors=5) knn.fit(trainX, trainY) testy = knn.predict(testX) zhv = np.mean(testy == tesY) print(zhv)
标签:查看 names port span hid cli isp import bsp
原文地址:https://www.cnblogs.com/lovelyemperor/p/10801273.html