python gridsearchcv 里的评价准则

本文介绍了使用scikit-learn进行模型选择与评估的方法,详细解释了如何通过scoring参数来定义评估规则,并列举了针对不同任务(如分类、回归等)可用的预定义评分值。

http://scikit-learn.org/stable/modules/model_evaluation.html

3.3.1. The scoring parameter: defining model evaluation rules

Model selection and evaluation using tools, such as model_selection.GridSearchCV and model_selection.cross_val_score, take a scoring parameter that controls what metric they apply to the estimators evaluated.

3.3.1.1. Common cases: predefined values

For the most common use cases, you can designate a scorer object with the scoring parameter; the table below shows all possible values. All scorer objects follow the convention that higher return values are better than lower return values. Thus metrics which measure the distance between the model and the data, like metrics.mean_squared_error, are available as neg_mean_squared_error which return the negated value of the metric.

ScoringFunctionComment
Classification  
‘accuracy’metrics.accuracy_score 
‘average_precision’metrics.average_precision_score 
‘f1’metrics.f1_scorefor binary targets
‘f1_micro’metrics.f1_scoremicro-averaged
‘f1_macro’metrics.f1_scoremacro-averaged
‘f1_weighted’metrics.f1_scoreweighted average
‘f1_samples’metrics.f1_scoreby multilabel sample
‘neg_log_loss’metrics.log_lossrequires predict_proba support
‘precision’ etc.metrics.precision_scoresuffixes apply as with ‘f1’
‘recall’ etc.metrics.recall_scoresuffixes apply as with ‘f1’
‘roc_auc’metrics.roc_auc_score 
Clustering  
‘adjusted_rand_score’metrics.adjusted_rand_score 
Regression  
‘neg_mean_absolute_error’metrics.mean_absolute_error 
‘neg_mean_squared_error’metrics.mean_squared_error 
‘neg_median_absolute_error’metrics.median_absolute_error 
‘r2’metrics.r2_score 

Usage examples:

转载于:https://www.cnblogs.com/xinping-study/p/6803165.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值