请教bobo老师, 为什么使用sklearn里面的gridSearch, 设置参数如下图:
grid_search = GridSearchCV(knn_clf, param_grid, cv = 3, n_jobs = -1, verbose=2)
跑出来的结果是:
estimator=KNeighborsClassifier(algorithm=‘auto’, leaf_size=30, metric=‘minkowski’,
metric_params=None, n_jobs=None, n_neighbors=5, p=2,
weights=‘uniform’),
但是, grid_search.best_params_ 跑出来的结果确是:
{‘n_neighbors’: 3, ‘p’: 3, ‘weights’: ‘distance’}
问题1. 为啥结果不一致?
问题2. 为什么verbose 怎么设置, 运行中打印的log还是什么少. 如下:
Fitting 3 folds for each of 60 candidates, totalling 180 fits
[Parallel(n_jobs=-1)]: Using backend LokyBackend with 4 concurrent workers.
[Parallel(n_jobs=-1)]: Done 17 tasks | elapsed: 8.0s
[Parallel(n_jobs=-1)]: Done 90 tasks | elapsed: 1.3min
CPU times: user 1.43 s, sys: 1.29 s, total: 2.72 s
Wall time: 3min 43s
[Parallel(n_jobs=-1)]: Done 180 out of 180 | elapsed: 3.7min finished