code

import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from sklearn import datasets
digits = datasets.load_digits()
#使用scikit-learn中的accuracy_score
from sklearn.model_selection import train_test_splitX = digits.data
y = digits.target
X_train,X_test,y_train,y_test = train_test_split(X,y,test_size = 0.2,random_state=666)#为了使实验过程可重复传入随机种子from sklearn.neighbors import KNeighborsClassifiermy_knn_clf = KNeighborsClassifier(n_neighbors = 3)
my_knn_clf.fit(X_train,y_train)
y_predict = my_knn_clf.predict(X_test)
my_knn_clf.score(X_test,y_test)
0.9888888888888889

定义好参数

#Grid Search定义好要搜索的参数的集合
param_grid = [{'weights':['uniform'],'n_neighbors':[i for i in range(1,11)]},{'weights':['distance'],'n_neighbors':[i for i in range(1,11)],'p':[i for i in range(1,6)]}]
knn_clf = KNeighborsClassifier()
from sklearn.model_selection import GridSearchCV
grid_search = GridSearchCV(knn_clf,param_grid)#定义好网格搜索对象
grid_search.fit(X_train,y_train)
GridSearchCV(estimator=KNeighborsClassifier(),param_grid=[{'n_neighbors': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],'weights': ['uniform']},{'n_neighbors': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],'p': [1, 2, 3, 4, 5], 'weights': ['distance']}])
grid_search.best_estimator_

grid_search.best_score_
0.9860820751064653
grid_search.best_params_
{'n_neighbors': 1, 'weights': 'uniform'}

返回最好的分类器

#返回最好的分类器
knn_clf = grid_search.best_estimator_
knn_clf.predict(X_test)

knn_clf.score(X_test,y_test)
0.9833333333333333

使用多核计算但是报错了

#多核计算
grid_search = GridSearchCV(knn_clf,param_grid,n_jobs=-1,verbose=2)
grid_search.fit(X_train,y_train)

结束了一些进程运行成果了,Python似乎不能内存回收。。

Fitting 5 folds for each of 60 candidates, totalling 300 fits
[CV] n_neighbors=1, weights=uniform ..................................
[CV] ...... n_neighbors=1, weights=uniform, score=0.983, total=   0.1s
[CV] n_neighbors=1, weights=uniform ..................................
[CV] ...... n_neighbors=1, weights=uniform, score=0.990, total=   0.1s
[CV] n_neighbors=1, weights=uniform ..................................
[CV] ...... n_neighbors=1, weights=uniform, score=0.986, total=   0.1s
[CV] n_neighbors=1, weights=uniform ..................................
[CV] ...... n_neighbors=1, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=1, weights=uniform ..................................
[CV] ...... n_neighbors=1, weights=uniform, score=0.993, total=   0.0s
[CV] n_neighbors=2, weights=uniform ..................................
[CV] ...... n_neighbors=2, weights=uniform, score=0.976, total=   0.0s
[CV] n_neighbors=2, weights=uniform ..................................
[CV] ...... n_neighbors=2, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=2, weights=uniform ..................................
[CV] ...... n_neighbors=2, weights=uniform, score=0.972, total=   0.0s
[CV] n_neighbors=2, weights=uniform ..................................
[CV] ...... n_neighbors=2, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=2, weights=uniform ..................................
[CV] ...... n_neighbors=2, weights=uniform, score=0.983, total=   0.0s
[CV] n_neighbors=3, weights=uniform ..................................
[CV] ...... n_neighbors=3, weights=uniform, score=0.983, total=   0.0s
[CV] n_neighbors=3, weights=uniform ..................................
[CV] ...... n_neighbors=3, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=3, weights=uniform ..................................
[CV] ...... n_neighbors=3, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=3, weights=uniform ..................................
[CV] ...... n_neighbors=3, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=3, weights=uniform ..................................
[CV] ...... n_neighbors=3, weights=uniform, score=0.986, total=   0.0s
[CV] n_neighbors=4, weights=uniform ..................................
[CV] ...... n_neighbors=4, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=4, weights=uniform ..................................
[CV] ...... n_neighbors=4, weights=uniform, score=0.993, total=   0.0s
[CV] n_neighbors=4, weights=uniform ..................................
[CV] ...... n_neighbors=4, weights=uniform, score=0.976, total=   0.0s
[CV] n_neighbors=4, weights=uniform ..................................
[CV] ...... n_neighbors=4, weights=uniform, score=0.976, total=   0.0s
[CV] n_neighbors=4, weights=uniform ..................................
[CV] ...... n_neighbors=4, weights=uniform, score=0.986, total=   0.0s
[CV] n_neighbors=5, weights=uniform ..................................
[CV] ...... n_neighbors=5, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=5, weights=uniform ..................................
[CV] ...... n_neighbors=5, weights=uniform, score=0.997, total=   0.0s
[CV] n_neighbors=5, weights=uniform ..................................
[CV] ...... n_neighbors=5, weights=uniform, score=0.983, total=   0.0s
[CV] n_neighbors=5, weights=uniform ..................................
[CV] ...... n_neighbors=5, weights=uniform, score=0.976, total=   0.0s
[CV] n_neighbors=5, weights=uniform ..................................
[CV] ...... n_neighbors=5, weights=uniform, score=0.983, total=   0.0s
[CV] n_neighbors=6, weights=uniform ..................................
[CV] ...... n_neighbors=6, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=6, weights=uniform ..................................
[CV] ...... n_neighbors=6, weights=uniform, score=0.990, total=   0.0s
[CV] n_neighbors=6, weights=uniform ..................................
[CV] ...... n_neighbors=6, weights=uniform, score=0.983, total=   0.0s
[CV] n_neighbors=6, weights=uniform ..................................
[CV] ...... n_neighbors=6, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=6, weights=uniform ..................................
[CV] ...... n_neighbors=6, weights=uniform, score=0.983, total=   0.0s
[CV] n_neighbors=7, weights=uniform ..................................
[CV] ...... n_neighbors=7, weights=uniform, score=0.976, total=   0.0s
[CV] n_neighbors=7, weights=uniform ..................................
[CV] ...... n_neighbors=7, weights=uniform, score=0.986, total=   0.0s
[CV] n_neighbors=7, weights=uniform ..................................
[CV] ...... n_neighbors=7, weights=uniform, score=0.983, total=   0.0s
[CV] n_neighbors=7, weights=uniform ..................................
[CV] ...... n_neighbors=7, weights=uniform, score=0.983, total=   0.0s
[CV] n_neighbors=7, weights=uniform ..................................
[CV] ...... n_neighbors=7, weights=uniform, score=0.986, total=   0.0s
[CV] n_neighbors=8, weights=uniform ..................................
[CV] ...... n_neighbors=8, weights=uniform, score=0.972, total=   0.0s
[CV] n_neighbors=8, weights=uniform ..................................
[CV] ...... n_neighbors=8, weights=uniform, score=0.993, total=   0.0s
[CV] n_neighbors=8, weights=uniform ..................................
[CV] ...... n_neighbors=8, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=8, weights=uniform ..................................
[CV] ...... n_neighbors=8, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=8, weights=uniform ..................................
[CV] ...... n_neighbors=8, weights=uniform, score=0.983, total=   0.0s
[CV] n_neighbors=9, weights=uniform ..................................
[CV] ...... n_neighbors=9, weights=uniform, score=0.972, total=   0.0s
[CV] n_neighbors=9, weights=uniform ..................................
[CV] ...... n_neighbors=9, weights=uniform, score=0.986, total=   0.1s
[CV] n_neighbors=9, weights=uniform ..................................
[CV] ...... n_neighbors=9, weights=uniform, score=0.979, total=   0.0s
[CV] n_neighbors=9, weights=uniform ..................................
[CV] ...... n_neighbors=9, weights=uniform, score=0.972, total=   0.0s
[CV] n_neighbors=9, weights=uniform ..................................
[CV] ...... n_neighbors=9, weights=uniform, score=0.983, total=   0.0s
[CV] n_neighbors=10, weights=uniform .................................
[CV] ..... n_neighbors=10, weights=uniform, score=0.965, total=   0.0s
[CV] n_neighbors=10, weights=uniform .................................
[CV] ..... n_neighbors=10, weights=uniform, score=0.990, total=   0.0s
[CV] n_neighbors=10, weights=uniform .................................
[CV] ..... n_neighbors=10, weights=uniform, score=0.976, total=   0.0s
[CV] n_neighbors=10, weights=uniform .................................
[CV] ..... n_neighbors=10, weights=uniform, score=0.965, total=   0.0s
[CV] n_neighbors=10, weights=uniform .................................
[CV] ..... n_neighbors=10, weights=uniform, score=0.983, total=   0.0s
[CV] n_neighbors=1, p=1, weights=distance ............................
[CV]  n_neighbors=1, p=1, weights=distance, score=0.972, total=   0.0s
[CV] n_neighbors=1, p=1, weights=distance ............................
[CV]  n_neighbors=1, p=1, weights=distance, score=0.986, total=   0.0s
[CV] n_neighbors=1, p=1, weights=distance ............................
[CV]  n_neighbors=1, p=1, weights=distance, score=0.976, total=   0.0s
[CV] n_neighbors=1, p=1, weights=distance ............................
[CV]  n_neighbors=1, p=1, weights=distance, score=0.972, total=   0.0s
[CV] n_neighbors=1, p=1, weights=distance ............................
[CV]  n_neighbors=1, p=1, weights=distance, score=0.990, total=   0.0s
[CV] n_neighbors=1, p=2, weights=distance ............................
[CV]  n_neighbors=1, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=1, p=2, weights=distance ............................
[CV]  n_neighbors=1, p=2, weights=distance, score=0.990, total=   0.0s
[CV] n_neighbors=1, p=2, weights=distance ............................
[CV]  n_neighbors=1, p=2, weights=distance, score=0.986, total=   0.0s
[CV] n_neighbors=1, p=2, weights=distance ............................
[CV]  n_neighbors=1, p=2, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=1, p=2, weights=distance ............................
[CV]  n_neighbors=1, p=2, weights=distance, score=0.993, total=   0.0s
[CV] n_neighbors=1, p=3, weights=distance ............................
[CV]  n_neighbors=1, p=3, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=1, p=3, weights=distance ............................
[CV]  n_neighbors=1, p=3, weights=distance, score=0.990, total=   0.3s
[CV] n_neighbors=1, p=3, weights=distance ............................
[CV]  n_neighbors=1, p=3, weights=distance, score=0.979, total=   0.3s
[CV] n_neighbors=1, p=3, weights=distance ............................
[CV]  n_neighbors=1, p=3, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=1, p=3, weights=distance ............................
[CV]  n_neighbors=1, p=3, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=1, p=4, weights=distance ............................
[CV]  n_neighbors=1, p=4, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=1, p=4, weights=distance ............................
[CV]  n_neighbors=1, p=4, weights=distance, score=0.990, total=   0.3s
[CV] n_neighbors=1, p=4, weights=distance ............................
[CV]  n_neighbors=1, p=4, weights=distance, score=0.979, total=   0.3s
[CV] n_neighbors=1, p=4, weights=distance ............................
[CV]  n_neighbors=1, p=4, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=1, p=4, weights=distance ............................
[CV]  n_neighbors=1, p=4, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=1, p=5, weights=distance ............................
[CV]  n_neighbors=1, p=5, weights=distance, score=0.990, total=   0.3s
[CV] n_neighbors=1, p=5, weights=distance ............................
[CV]  n_neighbors=1, p=5, weights=distance, score=0.993, total=   0.3s
[CV] n_neighbors=1, p=5, weights=distance ............................
[CV]  n_neighbors=1, p=5, weights=distance, score=0.979, total=   0.3s
[CV] n_neighbors=1, p=5, weights=distance ............................
[CV]  n_neighbors=1, p=5, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=1, p=5, weights=distance ............................
[CV]  n_neighbors=1, p=5, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=2, p=1, weights=distance ............................
[CV]  n_neighbors=2, p=1, weights=distance, score=0.969, total=   0.0s
[CV] n_neighbors=2, p=1, weights=distance ............................
[CV]  n_neighbors=2, p=1, weights=distance, score=0.986, total=   0.0s
[CV] n_neighbors=2, p=1, weights=distance ............................
[CV]  n_neighbors=2, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=2, p=1, weights=distance ............................
[CV]  n_neighbors=2, p=1, weights=distance, score=0.972, total=   0.0s
[CV] n_neighbors=2, p=1, weights=distance ............................
[CV]  n_neighbors=2, p=1, weights=distance, score=0.990, total=   0.0s
[CV] n_neighbors=2, p=2, weights=distance ............................
[CV]  n_neighbors=2, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=2, p=2, weights=distance ............................
[CV]  n_neighbors=2, p=2, weights=distance, score=0.990, total=   0.0s
[CV] n_neighbors=2, p=2, weights=distance ............................
[CV]  n_neighbors=2, p=2, weights=distance, score=0.986, total=   0.0s
[CV] n_neighbors=2, p=2, weights=distance ............................
[CV]  n_neighbors=2, p=2, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=2, p=2, weights=distance ............................
[CV]  n_neighbors=2, p=2, weights=distance, score=0.993, total=   0.0s
[CV] n_neighbors=2, p=3, weights=distance ............................
[CV]  n_neighbors=2, p=3, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=2, p=3, weights=distance ............................
[CV]  n_neighbors=2, p=3, weights=distance, score=0.990, total=   0.4s
[CV] n_neighbors=2, p=3, weights=distance ............................
[CV]  n_neighbors=2, p=3, weights=distance, score=0.979, total=   0.4s
[CV] n_neighbors=2, p=3, weights=distance ............................
[CV]  n_neighbors=2, p=3, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=2, p=3, weights=distance ............................
[CV]  n_neighbors=2, p=3, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=2, p=4, weights=distance ............................
[CV]  n_neighbors=2, p=4, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=2, p=4, weights=distance ............................
[CV]  n_neighbors=2, p=4, weights=distance, score=0.990, total=   0.3s
[CV] n_neighbors=2, p=4, weights=distance ............................
[CV]  n_neighbors=2, p=4, weights=distance, score=0.979, total=   0.3s
[CV] n_neighbors=2, p=4, weights=distance ............................
[CV]  n_neighbors=2, p=4, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=2, p=4, weights=distance ............................
[CV]  n_neighbors=2, p=4, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=2, p=5, weights=distance ............................
[CV]  n_neighbors=2, p=5, weights=distance, score=0.990, total=   0.3s
[CV] n_neighbors=2, p=5, weights=distance ............................
[CV]  n_neighbors=2, p=5, weights=distance, score=0.993, total=   0.3s
[CV] n_neighbors=2, p=5, weights=distance ............................
[CV]  n_neighbors=2, p=5, weights=distance, score=0.979, total=   0.3s
[CV] n_neighbors=2, p=5, weights=distance ............................
[CV]  n_neighbors=2, p=5, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=2, p=5, weights=distance ............................
[CV]  n_neighbors=2, p=5, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=3, p=1, weights=distance ............................
[CV]  n_neighbors=3, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=3, p=1, weights=distance ............................
[CV]  n_neighbors=3, p=1, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=3, p=1, weights=distance ............................
[CV]  n_neighbors=3, p=1, weights=distance, score=0.976, total=   0.0s
[CV] n_neighbors=3, p=1, weights=distance ............................
[CV]  n_neighbors=3, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=3, p=1, weights=distance ............................
[CV]  n_neighbors=3, p=1, weights=distance, score=0.986, total=   0.0s
[CV] n_neighbors=3, p=2, weights=distance ............................
[CV]  n_neighbors=3, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=3, p=2, weights=distance ............................
[CV]  n_neighbors=3, p=2, weights=distance, score=0.986, total=   0.0s
[CV] n_neighbors=3, p=2, weights=distance ............................
[CV]  n_neighbors=3, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=3, p=2, weights=distance ............................
[CV]  n_neighbors=3, p=2, weights=distance, score=0.976, total=   0.0s
[CV] n_neighbors=3, p=2, weights=distance ............................
[CV]  n_neighbors=3, p=2, weights=distance, score=0.986, total=   0.0s
[CV] n_neighbors=3, p=3, weights=distance ............................
[CV]  n_neighbors=3, p=3, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=3, p=3, weights=distance ............................
[CV]  n_neighbors=3, p=3, weights=distance, score=0.997, total=   0.4s
[CV] n_neighbors=3, p=3, weights=distance ............................
[CV]  n_neighbors=3, p=3, weights=distance, score=0.979, total=   0.4s
[CV] n_neighbors=3, p=3, weights=distance ............................
[CV]  n_neighbors=3, p=3, weights=distance, score=0.972, total=   0.4s
[CV] n_neighbors=3, p=3, weights=distance ............................
[CV]  n_neighbors=3, p=3, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=3, p=4, weights=distance ............................
[CV]  n_neighbors=3, p=4, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=3, p=4, weights=distance ............................
[CV]  n_neighbors=3, p=4, weights=distance, score=0.993, total=   0.3s
[CV] n_neighbors=3, p=4, weights=distance ............................
[CV]  n_neighbors=3, p=4, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=3, p=4, weights=distance ............................
[CV]  n_neighbors=3, p=4, weights=distance, score=0.972, total=   0.3s
[CV] n_neighbors=3, p=4, weights=distance ............................
[CV]  n_neighbors=3, p=4, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=3, p=5, weights=distance ............................
[CV]  n_neighbors=3, p=5, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=3, p=5, weights=distance ............................
[CV]  n_neighbors=3, p=5, weights=distance, score=0.993, total=   0.3s
[CV] n_neighbors=3, p=5, weights=distance ............................
[CV]  n_neighbors=3, p=5, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=3, p=5, weights=distance ............................
[CV]  n_neighbors=3, p=5, weights=distance, score=0.979, total=   0.3s
[CV] n_neighbors=3, p=5, weights=distance ............................
[CV]  n_neighbors=3, p=5, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=4, p=1, weights=distance ............................
[CV]  n_neighbors=4, p=1, weights=distance, score=0.976, total=   0.0s
[CV] n_neighbors=4, p=1, weights=distance ............................
[CV]  n_neighbors=4, p=1, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=4, p=1, weights=distance ............................
[CV]  n_neighbors=4, p=1, weights=distance, score=0.976, total=   0.0s
[CV] n_neighbors=4, p=1, weights=distance ............................
[CV]  n_neighbors=4, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=4, p=1, weights=distance ............................
[CV]  n_neighbors=4, p=1, weights=distance, score=0.986, total=   0.0s
[CV] n_neighbors=4, p=2, weights=distance ............................
[CV]  n_neighbors=4, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=4, p=2, weights=distance ............................
[CV]  n_neighbors=4, p=2, weights=distance, score=0.990, total=   0.0s
[CV] n_neighbors=4, p=2, weights=distance ............................
[CV]  n_neighbors=4, p=2, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=4, p=2, weights=distance ............................
[CV]  n_neighbors=4, p=2, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=4, p=2, weights=distance ............................
[CV]  n_neighbors=4, p=2, weights=distance, score=0.986, total=   0.0s
[CV] n_neighbors=4, p=3, weights=distance ............................
[CV]  n_neighbors=4, p=3, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=4, p=3, weights=distance ............................
[CV]  n_neighbors=4, p=3, weights=distance, score=0.990, total=   0.4s
[CV] n_neighbors=4, p=3, weights=distance ............................
[CV]  n_neighbors=4, p=3, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=4, p=3, weights=distance ............................
[CV]  n_neighbors=4, p=3, weights=distance, score=0.976, total=   0.4s
[CV] n_neighbors=4, p=3, weights=distance ............................
[CV]  n_neighbors=4, p=3, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=4, p=4, weights=distance ............................
[CV]  n_neighbors=4, p=4, weights=distance, score=0.983, total=   0.3s
[CV] n_neighbors=4, p=4, weights=distance ............................
[CV]  n_neighbors=4, p=4, weights=distance, score=0.993, total=   0.4s
[CV] n_neighbors=4, p=4, weights=distance ............................
[CV]  n_neighbors=4, p=4, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=4, p=4, weights=distance ............................
[CV]  n_neighbors=4, p=4, weights=distance, score=0.969, total=   0.5s
[CV] n_neighbors=4, p=4, weights=distance ............................
[CV]  n_neighbors=4, p=4, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=4, p=5, weights=distance ............................
[CV]  n_neighbors=4, p=5, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=4, p=5, weights=distance ............................
[CV]  n_neighbors=4, p=5, weights=distance, score=0.993, total=   0.3s
[CV] n_neighbors=4, p=5, weights=distance ............................
[CV]  n_neighbors=4, p=5, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=4, p=5, weights=distance ............................
[CV]  n_neighbors=4, p=5, weights=distance, score=0.972, total=   0.3s
[CV] n_neighbors=4, p=5, weights=distance ............................
[CV]  n_neighbors=4, p=5, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=5, p=1, weights=distance ............................
[CV]  n_neighbors=5, p=1, weights=distance, score=0.969, total=   0.0s
[CV] n_neighbors=5, p=1, weights=distance ............................
[CV]  n_neighbors=5, p=1, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=5, p=1, weights=distance ............................
[CV]  n_neighbors=5, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=5, p=1, weights=distance ............................
[CV]  n_neighbors=5, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=5, p=1, weights=distance ............................
[CV]  n_neighbors=5, p=1, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=5, p=2, weights=distance ............................
[CV]  n_neighbors=5, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=5, p=2, weights=distance ............................
[CV]  n_neighbors=5, p=2, weights=distance, score=0.997, total=   0.0s
[CV] n_neighbors=5, p=2, weights=distance ............................
[CV]  n_neighbors=5, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=5, p=2, weights=distance ............................
[CV]  n_neighbors=5, p=2, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=5, p=2, weights=distance ............................
[CV]  n_neighbors=5, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=5, p=3, weights=distance ............................
[CV]  n_neighbors=5, p=3, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=5, p=3, weights=distance ............................
[CV]  n_neighbors=5, p=3, weights=distance, score=0.993, total=   0.4s
[CV] n_neighbors=5, p=3, weights=distance ............................
[CV]  n_neighbors=5, p=3, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=5, p=3, weights=distance ............................
[CV]  n_neighbors=5, p=3, weights=distance, score=0.979, total=   0.4s
[CV] n_neighbors=5, p=3, weights=distance ............................
[CV]  n_neighbors=5, p=3, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=5, p=4, weights=distance ............................
[CV]  n_neighbors=5, p=4, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=5, p=4, weights=distance ............................
[CV]  n_neighbors=5, p=4, weights=distance, score=0.993, total=   0.4s
[CV] n_neighbors=5, p=4, weights=distance ............................
[CV]  n_neighbors=5, p=4, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=5, p=4, weights=distance ............................
[CV]  n_neighbors=5, p=4, weights=distance, score=0.976, total=   0.4s
[CV] n_neighbors=5, p=4, weights=distance ............................
[CV]  n_neighbors=5, p=4, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=5, p=5, weights=distance ............................
[CV]  n_neighbors=5, p=5, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=5, p=5, weights=distance ............................
[CV]  n_neighbors=5, p=5, weights=distance, score=0.993, total=   0.4s
[CV] n_neighbors=5, p=5, weights=distance ............................
[CV]  n_neighbors=5, p=5, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=5, p=5, weights=distance ............................
[CV]  n_neighbors=5, p=5, weights=distance, score=0.972, total=   0.3s
[CV] n_neighbors=5, p=5, weights=distance ............................
[CV]  n_neighbors=5, p=5, weights=distance, score=0.986, total=   0.3s
[CV] n_neighbors=6, p=1, weights=distance ............................
[CV]  n_neighbors=6, p=1, weights=distance, score=0.972, total=   0.0s
[CV] n_neighbors=6, p=1, weights=distance ............................
[CV]  n_neighbors=6, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=6, p=1, weights=distance ............................
[CV]  n_neighbors=6, p=1, weights=distance, score=0.976, total=   0.0s
[CV] n_neighbors=6, p=1, weights=distance ............................
[CV]  n_neighbors=6, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=6, p=1, weights=distance ............................
[CV]  n_neighbors=6, p=1, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=6, p=2, weights=distance ............................
[CV]  n_neighbors=6, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=6, p=2, weights=distance ............................
[CV]  n_neighbors=6, p=2, weights=distance, score=0.997, total=   0.0s
[CV] n_neighbors=6, p=2, weights=distance ............................
[CV]  n_neighbors=6, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=6, p=2, weights=distance ............................
[CV]  n_neighbors=6, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=6, p=2, weights=distance ............................
[CV]  n_neighbors=6, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=6, p=3, weights=distance ............................
[CV]  n_neighbors=6, p=3, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=6, p=3, weights=distance ............................
[CV]  n_neighbors=6, p=3, weights=distance, score=0.993, total=   0.4s
[CV] n_neighbors=6, p=3, weights=distance ............................
[CV]  n_neighbors=6, p=3, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=6, p=3, weights=distance ............................
[CV]  n_neighbors=6, p=3, weights=distance, score=0.972, total=   0.4s
[CV] n_neighbors=6, p=3, weights=distance ............................
[CV]  n_neighbors=6, p=3, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=6, p=4, weights=distance ............................
[CV]  n_neighbors=6, p=4, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=6, p=4, weights=distance ............................
[CV]  n_neighbors=6, p=4, weights=distance, score=0.993, total=   0.4s
[CV] n_neighbors=6, p=4, weights=distance ............................
[CV]  n_neighbors=6, p=4, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=6, p=4, weights=distance ............................
[CV]  n_neighbors=6, p=4, weights=distance, score=0.976, total=   0.4s
[CV] n_neighbors=6, p=4, weights=distance ............................
[CV]  n_neighbors=6, p=4, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=6, p=5, weights=distance ............................
[CV]  n_neighbors=6, p=5, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=6, p=5, weights=distance ............................
[CV]  n_neighbors=6, p=5, weights=distance, score=0.993, total=   0.4s
[CV] n_neighbors=6, p=5, weights=distance ............................
[CV]  n_neighbors=6, p=5, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=6, p=5, weights=distance ............................
[CV]  n_neighbors=6, p=5, weights=distance, score=0.972, total=   0.3s
[CV] n_neighbors=6, p=5, weights=distance ............................
[CV]  n_neighbors=6, p=5, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=7, p=1, weights=distance ............................
[CV]  n_neighbors=7, p=1, weights=distance, score=0.962, total=   0.0s
[CV] n_neighbors=7, p=1, weights=distance ............................
[CV]  n_neighbors=7, p=1, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=7, p=1, weights=distance ............................
[CV]  n_neighbors=7, p=1, weights=distance, score=0.969, total=   0.0s
[CV] n_neighbors=7, p=1, weights=distance ............................
[CV]  n_neighbors=7, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=7, p=1, weights=distance ............................
[CV]  n_neighbors=7, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=7, p=2, weights=distance ............................
[CV]  n_neighbors=7, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=7, p=2, weights=distance ............................
[CV]  n_neighbors=7, p=2, weights=distance, score=0.990, total=   0.0s
[CV] n_neighbors=7, p=2, weights=distance ............................
[CV]  n_neighbors=7, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=7, p=2, weights=distance ............................
[CV]  n_neighbors=7, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=7, p=2, weights=distance ............................
[CV]  n_neighbors=7, p=2, weights=distance, score=0.986, total=   0.0s
[CV] n_neighbors=7, p=3, weights=distance ............................
[CV]  n_neighbors=7, p=3, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=7, p=3, weights=distance ............................
[CV]  n_neighbors=7, p=3, weights=distance, score=0.997, total=   0.4s
[CV] n_neighbors=7, p=3, weights=distance ............................
[CV]  n_neighbors=7, p=3, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=7, p=3, weights=distance ............................
[CV]  n_neighbors=7, p=3, weights=distance, score=0.972, total=   0.4s
[CV] n_neighbors=7, p=3, weights=distance ............................
[CV]  n_neighbors=7, p=3, weights=distance, score=0.990, total=   0.4s
[CV] n_neighbors=7, p=4, weights=distance ............................
[CV]  n_neighbors=7, p=4, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=7, p=4, weights=distance ............................
[CV]  n_neighbors=7, p=4, weights=distance, score=0.997, total=   0.4s
[CV] n_neighbors=7, p=4, weights=distance ............................
[CV]  n_neighbors=7, p=4, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=7, p=4, weights=distance ............................
[CV]  n_neighbors=7, p=4, weights=distance, score=0.979, total=   0.4s
[CV] n_neighbors=7, p=4, weights=distance ............................
[CV]  n_neighbors=7, p=4, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=7, p=5, weights=distance ............................
[CV]  n_neighbors=7, p=5, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=7, p=5, weights=distance ............................
[CV]  n_neighbors=7, p=5, weights=distance, score=0.993, total=   0.4s
[CV] n_neighbors=7, p=5, weights=distance ............................
[CV]  n_neighbors=7, p=5, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=7, p=5, weights=distance ............................
[CV]  n_neighbors=7, p=5, weights=distance, score=0.976, total=   0.4s
[CV] n_neighbors=7, p=5, weights=distance ............................
[CV]  n_neighbors=7, p=5, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=8, p=1, weights=distance ............................
[CV]  n_neighbors=8, p=1, weights=distance, score=0.972, total=   0.0s
[CV] n_neighbors=8, p=1, weights=distance ............................
[CV]  n_neighbors=8, p=1, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=8, p=1, weights=distance ............................
[CV]  n_neighbors=8, p=1, weights=distance, score=0.976, total=   0.0s
[CV] n_neighbors=8, p=1, weights=distance ............................
[CV]  n_neighbors=8, p=1, weights=distance, score=0.976, total=   0.0s
[CV] n_neighbors=8, p=1, weights=distance ............................
[CV]  n_neighbors=8, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=8, p=2, weights=distance ............................
[CV]  n_neighbors=8, p=2, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=8, p=2, weights=distance ............................
[CV]  n_neighbors=8, p=2, weights=distance, score=0.997, total=   0.0s
[CV] n_neighbors=8, p=2, weights=distance ............................
[CV]  n_neighbors=8, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=8, p=2, weights=distance ............................
[CV]  n_neighbors=8, p=2, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=8, p=2, weights=distance ............................
[CV]  n_neighbors=8, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=8, p=3, weights=distance ............................
[CV]  n_neighbors=8, p=3, weights=distance, score=0.976, total=   0.4s
[CV] n_neighbors=8, p=3, weights=distance ............................
[CV]  n_neighbors=8, p=3, weights=distance, score=0.997, total=   0.4s
[CV] n_neighbors=8, p=3, weights=distance ............................
[CV]  n_neighbors=8, p=3, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=8, p=3, weights=distance ............................
[CV]  n_neighbors=8, p=3, weights=distance, score=0.976, total=   0.4s
[CV] n_neighbors=8, p=3, weights=distance ............................
[CV]  n_neighbors=8, p=3, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=8, p=4, weights=distance ............................
[CV]  n_neighbors=8, p=4, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=8, p=4, weights=distance ............................
[CV]  n_neighbors=8, p=4, weights=distance, score=0.997, total=   0.4s
[CV] n_neighbors=8, p=4, weights=distance ............................
[CV]  n_neighbors=8, p=4, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=8, p=4, weights=distance ............................
[CV]  n_neighbors=8, p=4, weights=distance, score=0.979, total=   0.4s
[CV] n_neighbors=8, p=4, weights=distance ............................
[CV]  n_neighbors=8, p=4, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=8, p=5, weights=distance ............................
[CV]  n_neighbors=8, p=5, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=8, p=5, weights=distance ............................
[CV]  n_neighbors=8, p=5, weights=distance, score=0.997, total=   0.4s
[CV] n_neighbors=8, p=5, weights=distance ............................
[CV]  n_neighbors=8, p=5, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=8, p=5, weights=distance ............................
[CV]  n_neighbors=8, p=5, weights=distance, score=0.972, total=   0.4s
[CV] n_neighbors=8, p=5, weights=distance ............................
[CV]  n_neighbors=8, p=5, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=9, p=1, weights=distance ............................
[CV]  n_neighbors=9, p=1, weights=distance, score=0.965, total=   0.0s
[CV] n_neighbors=9, p=1, weights=distance ............................
[CV]  n_neighbors=9, p=1, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=9, p=1, weights=distance ............................
[CV]  n_neighbors=9, p=1, weights=distance, score=0.965, total=   0.0s
[CV] n_neighbors=9, p=1, weights=distance ............................
[CV]  n_neighbors=9, p=1, weights=distance, score=0.972, total=   0.0s
[CV] n_neighbors=9, p=1, weights=distance ............................
[CV]  n_neighbors=9, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=9, p=2, weights=distance ............................
[CV]  n_neighbors=9, p=2, weights=distance, score=0.976, total=   0.0s
[CV] n_neighbors=9, p=2, weights=distance ............................
[CV]  n_neighbors=9, p=2, weights=distance, score=0.993, total=   0.0s
[CV] n_neighbors=9, p=2, weights=distance ............................
[CV]  n_neighbors=9, p=2, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=9, p=2, weights=distance ............................
[CV]  n_neighbors=9, p=2, weights=distance, score=0.976, total=   0.0s
[CV] n_neighbors=9, p=2, weights=distance ............................
[CV]  n_neighbors=9, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=9, p=3, weights=distance ............................
[CV]  n_neighbors=9, p=3, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=9, p=3, weights=distance ............................
[CV]  n_neighbors=9, p=3, weights=distance, score=0.997, total=   0.4s
[CV] n_neighbors=9, p=3, weights=distance ............................
[CV]  n_neighbors=9, p=3, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=9, p=3, weights=distance ............................
[CV]  n_neighbors=9, p=3, weights=distance, score=0.972, total=   0.4s
[CV] n_neighbors=9, p=3, weights=distance ............................
[CV]  n_neighbors=9, p=3, weights=distance, score=0.986, total=   0.4s
[CV] n_neighbors=9, p=4, weights=distance ............................
[CV]  n_neighbors=9, p=4, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=9, p=4, weights=distance ............................
[CV]  n_neighbors=9, p=4, weights=distance, score=0.997, total=   0.4s
[CV] n_neighbors=9, p=4, weights=distance ............................
[CV]  n_neighbors=9, p=4, weights=distance, score=0.979, total=   0.4s
[CV] n_neighbors=9, p=4, weights=distance ............................
[CV]  n_neighbors=9, p=4, weights=distance, score=0.979, total=   0.4s
[CV] n_neighbors=9, p=4, weights=distance ............................
[CV]  n_neighbors=9, p=4, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=9, p=5, weights=distance ............................
[CV]  n_neighbors=9, p=5, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=9, p=5, weights=distance ............................
[CV]  n_neighbors=9, p=5, weights=distance, score=0.997, total=   0.4s
[CV] n_neighbors=9, p=5, weights=distance ............................
[CV]  n_neighbors=9, p=5, weights=distance, score=0.979, total=   0.4s
[CV] n_neighbors=9, p=5, weights=distance ............................
[CV]  n_neighbors=9, p=5, weights=distance, score=0.972, total=   0.4s
[CV] n_neighbors=9, p=5, weights=distance ............................
[CV]  n_neighbors=9, p=5, weights=distance, score=0.979, total=   0.4s
[CV] n_neighbors=10, p=1, weights=distance ...........................
[CV]  n_neighbors=10, p=1, weights=distance, score=0.972, total=   0.0s
[CV] n_neighbors=10, p=1, weights=distance ...........................
[CV]  n_neighbors=10, p=1, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=10, p=1, weights=distance ...........................
[CV]  n_neighbors=10, p=1, weights=distance, score=0.969, total=   0.0s
[CV] n_neighbors=10, p=1, weights=distance ...........................
[CV]  n_neighbors=10, p=1, weights=distance, score=0.972, total=   0.0s
[CV] n_neighbors=10, p=1, weights=distance ...........................
[CV]  n_neighbors=10, p=1, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=10, p=2, weights=distance ...........................
[CV]  n_neighbors=10, p=2, weights=distance, score=0.972, total=   0.0s
[CV] n_neighbors=10, p=2, weights=distance ...........................
[CV]  n_neighbors=10, p=2, weights=distance, score=0.993, total=   0.0s
[CV] n_neighbors=10, p=2, weights=distance ...........................
[CV]  n_neighbors=10, p=2, weights=distance, score=0.979, total=   0.0s
[CV] n_neighbors=10, p=2, weights=distance ...........................
[CV]  n_neighbors=10, p=2, weights=distance, score=0.976, total=   0.0s
[CV] n_neighbors=10, p=2, weights=distance ...........................
[CV]  n_neighbors=10, p=2, weights=distance, score=0.983, total=   0.0s
[CV] n_neighbors=10, p=3, weights=distance ...........................
[CV]  n_neighbors=10, p=3, weights=distance, score=0.972, total=   0.4s
[CV] n_neighbors=10, p=3, weights=distance ...........................
[CV]  n_neighbors=10, p=3, weights=distance, score=0.993, total=   0.4s
[CV] n_neighbors=10, p=3, weights=distance ...........................
[CV]  n_neighbors=10, p=3, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=10, p=3, weights=distance ...........................
[CV]  n_neighbors=10, p=3, weights=distance, score=0.972, total=   0.4s
[CV] n_neighbors=10, p=3, weights=distance ...........................
[CV]  n_neighbors=10, p=3, weights=distance, score=0.979, total=   0.4s
[CV] n_neighbors=10, p=4, weights=distance ...........................
[CV]  n_neighbors=10, p=4, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=10, p=4, weights=distance ...........................
[CV]  n_neighbors=10, p=4, weights=distance, score=0.993, total=   0.4s
[CV] n_neighbors=10, p=4, weights=distance ...........................
[CV]  n_neighbors=10, p=4, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=10, p=4, weights=distance ...........................
[CV]  n_neighbors=10, p=4, weights=distance, score=0.979, total=   0.4s
[CV] n_neighbors=10, p=4, weights=distance ...........................
[CV]  n_neighbors=10, p=4, weights=distance, score=0.976, total=   0.4s
[CV] n_neighbors=10, p=5, weights=distance ...........................
[CV]  n_neighbors=10, p=5, weights=distance, score=0.979, total=   0.4s
[CV] n_neighbors=10, p=5, weights=distance ...........................
[CV]  n_neighbors=10, p=5, weights=distance, score=0.993, total=   0.4s
[CV] n_neighbors=10, p=5, weights=distance ...........................
[CV]  n_neighbors=10, p=5, weights=distance, score=0.983, total=   0.4s
[CV] n_neighbors=10, p=5, weights=distance ...........................
[CV]  n_neighbors=10, p=5, weights=distance, score=0.972, total=   0.4s
[CV] n_neighbors=10, p=5, weights=distance ...........................
[CV]  n_neighbors=10, p=5, weights=distance, score=0.986, total=   0.4s
Wall time: 1min

[Parallel(n_jobs=1)]: Using backend SequentialBackend with 1 concurrent workers.
[Parallel(n_jobs=1)]: Done   1 out of   1 | elapsed:    0.0s remaining:    0.0s
[Parallel(n_jobs=1)]: Done   2 out of   2 | elapsed:    0.0s remaining:    0.0s
[Parallel(n_jobs=1)]: Done 300 out of 300 | elapsed:  1.0min finished
GridSearchCV(estimator=KNeighborsClassifier(n_neighbors=1), n_jobs=1,param_grid=[{'n_neighbors': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],'weights': ['uniform']},{'n_neighbors': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],'p': [1, 2, 3, 4, 5], 'weights': ['distance']}],verbose=3)

Python机器学习:KNN算法06网格搜索相关推荐

  1. python网格搜索核函数_(转载)Python机器学习笔记GridSearchCV(网格搜索)

    转载声明 介绍 在机器学习模型中,需要人工选择的参数称为超参数.比如随机森林中决策树的个数,人工神经网络模型中隐藏层层数和每层的节点个数,正则项中常数大小等等,他们都需要事先指定.超参数选择不恰当,就 ...

  2. 机器学习 —— KNN算法简单入门

    机器学习 -- KNN算法简单入门 第1关:手动实现简单kNN算法 1 KNN算法简介 1.1 kNN 算法的算法流程 1.2 kNN 算法的优缺点 1.3 编程要求+参数解释 2. 代码实现 3. ...

  3. Python实现kNN算法

    Python实现kNN算法 1. 原理 k-最近邻: kNN(k-NearestNeighbor)分类算法机器学习中最简单的分类方法之一.所谓K最近邻,就是k个最近的邻居的意思,说的是每个样本都可以用 ...

  4. 机器学习knn算法学习笔记使用sklearn库 ,莺尾花实例

    ** 机器学习knn算法学习笔记使用sklearn库 ,莺尾花实例. 具体knn算法是怎样的我这里就不再详细论述.在这里我注意总结我使用knn算法进行一个分类的分析 ** 分析过程 1.前期准备 引入 ...

  5. 课程设计(毕业设计)—基于机器学习KNN算法手写数字识别系统—计算机专业课程设计(毕业设计)

    机器学习KNN算法手写数字识别系统 下载本文手写数字识别系统完整的代码和课设报告的链接(或者可以联系博主koukou(壹壹23七2五六98),获取源码和报告):https://download.csd ...

  6. 机器学习KNN算法实践:预测城市空气质量

    出品:Python数据之道 作者:叶庭云 整理:Lemon 机器学习KNN算法实践 预测城市空气质量 「Python数据之道」导读: 之前在公众号上分享过 "图解KNN算法" 的内 ...

  7. Python实现KNN算法(鸢尾花集)

    不同颜色的鸢尾花花语不尽相同,蓝色鸢尾花语是精致的美丽,红色鸢尾花的花语代表着热情.适应力强.紫蓝色鸢尾花花语代表着好消息.想念你.黄色鸢尾花的花语代表着友谊永固.热情开朗,白色鸢尾花花语代表着纯真. ...

  8. 机器学习 KNN算法实践

    作者 | 叶庭云 来源 | 修炼Python 头图 | 下载于视觉中国 KNN算法简介 KNN(K-Nearest Neighbor)最邻近分类算法是数据挖掘分类(classification)技术中 ...

  9. 机器学习——KNN算法

    机器学习--KNN算法 文章目录 机器学习--KNN算法 前言 一.KNN原理基础 二.sklearn的基本建模流程 三.KNN算法调优:选取最优的K值 四.KNN中距离的相关讨论 1. KNN使用的 ...

最新文章

  1. python读取配置文件存在某配置_Python读取配置文件(config.ini)以及写入配置文件
  2. 编程语言python入门要电脑什么配置能带动-要学一门编程语言,那我一定选择Python!...
  3. LeetCode Populating Next Right Pointers in Each Node(dfs)
  4. java bean 验证_Java Bean验证基础
  5. 小明系列问题――小明序列(LIS)
  6. 北京计算机一级2020,2020北京市一级计算机基础及MS Office应用考试在线自测试题库(不限设备,登陆即可做题)...
  7. 快速理解设计模式六大原则
  8. 【渝粤教育】电大中专跨境电子商务理论与实务 (27)作业 题库
  9. vim格式化代码实际上就是 缩进代码, 命令是等号=
  10. DirectShow系统概述
  11. Redhat 系列漏洞补丁加固
  12. 阿西莫夫机器人三定律
  13. 液晶显示器常见、尺寸、分辨率、点距
  14. excel表格添加文字太长了,需要换行?
  15. Python 优雅地利用两点经纬度计算地理空间距离
  16. 微信开发(3)微信支付
  17. 数据挖掘(二)预测潜在贷款发放客户
  18. (20)全民小视频引流脚本模块化开发14-给脚本添加本地授权By飞云脚本学院
  19. 合泰32-Onenet-WiFi模块-合泰单片机通过MQTT协议数据上云(一)
  20. Java iText5.5.1 绘制PDF表格

热门文章

  1. pygame为游戏添加背景_用 Python 制作飞机大战小游戏
  2. 2017.9.26 货币兑换 失败总结
  3. 【英语学习】【English L06】U08 News L5 They are expecting a baby!
  4. 希尔伯特向量空间中的信号
  5. c语言连接别人的网络,链接别人的无线网络WIFI不知道密码该如何获取
  6. 组态王opc_组态王和西门子S7300、S7400系列PLC通讯的几种配置方案
  7. Performance Optimization for Mobile Devices
  8. Keras-7 Reuters, a multiclass classification example
  9. php基础教程(二):基础语法
  10. MyEclipse安装JS代码提示(Spket插件)