jjzjj

LogisticRegressionCV

全部标签

python - 比较在 scikit-learn 中调整超参数的方法

这篇文章是关于LogisticRegressionCV、GridSearchCV和cross_val_score之间的区别。考虑以下设置:importnumpyasnpfromsklearn.datasetsimportload_digitsfromsklearn.linear_modelimportLogisticRegression,LogisticRegressionCVfromsklearn.model_selectionimporttrain_test_split,GridSearchCV,\StratifiedKFold,cross_val_scorefromsklearn

python - 如何在 scikit-learn 的 LogisticRegressionCV 调用中将参数传递给评分函数

问题我正在尝试使用scikit-learn的LogisticRegressionCV与roc_auc_score作为评分指标。fromsklearn.linear_modelimportLogisticRegressionfromsklearn.metricsimportroc_auc_scoreclf=LogisticRegressionCV(scoring=roc_auc_score)但是当我尝试拟合模型时(clf.fit(X,y)),它会抛出一个错误。ValueError:averagehastobeoneof(None,'micro','macro','weighted','s