Parameters 如何通过网格搜索绘制最佳超参数的AUC

Parameters 如何通过网格搜索绘制最佳超参数的AUC,parameters,data-science,knn,auc,hyper,Parameters,Data Science,Knn,Auc,Hyper,我使用下面的代码来获得最佳的超参数,它将通过网格搜索给出最大的AUC值。但我无法描绘它 model = KNeighborsClassifier() #Hyper Parameters Set params = {'n_neighbors':[5,10,15,20,25,30,35], 'leaf_size':[1,2,3,4], 'weights':['uniform', 'distance'], 'algorithm':['brute']

我使用下面的代码来获得最佳的超参数,它将通过网格搜索给出最大的AUC值。但我无法描绘它

 model = KNeighborsClassifier()
 #Hyper Parameters Set
 params = {'n_neighbors':[5,10,15,20,25,30,35],
      'leaf_size':[1,2,3,4],
      'weights':['uniform', 'distance'],
      'algorithm':['brute']
      }
#Making models with hyper parameters sets
model1_tfidf = GridSearchCV(model, param_grid=params)
model1_tfidf.fit(final_X_train_tfidf,y_train)
print("Best Hyper Parameters:\n",model1.best_params_)

GridsearchCV只返回CV分数,但不会绘制roc曲线

遵循以下堆栈溢出链接:

您需要从sklearn.metrics导入plot\u roc\u曲线
,然后使用gridsearch的名称
plot\u roc\u曲线(model1\u tfidf,X\u test,y\u test)
如果您愿意,请在保留样本或训练集上。