[PYTHON] Setting of evaluation index for cross-validation (memo, scikit-learn, cross_validation.cross_val_score)

case of cross_validation.cross_val_score

Specify the value of this ** scoring **! !!

scores = cross_validation.cross_val_score(clf, X_digits, y_digits, cv=k_fold, ... scoring='precision_macro')

Even when I heard the presentation at the conference, the evaluation index of cross-validation was often a mystery. I was wondering if it would be uniquely determined depending on the target (old days). You choose properly depending on your purpose ^^;

** List list, details can be jumped further from the link ** http://scikit-learn.org/stable/modules/model_evaluation.html#scoring-parameter

['accuracy', 'adjusted_rand_score', 'average_precision', 'f1', 'f1_macro', 
'f1_micro', 'f1_samples', 'f1_weighted', 'log_loss', 'mean_absolute_error', 
'mean_squared_error', 'median_absolute_error', 'precision',
'precision_macro', 'precision_micro', 'precision_samples', 
'precision_weighted', 'r2', 'recall', 'recall_macro', 'recall_micro', 
'recall_samples', 'recall_weighted', 'roc_auc']

'accuracy' accuracy_score  Many samples do so in binary classification, but this is the default? Formally, it's like this. alt

At the time of the return, Mr. Daibutsu wrote. The table has neg_, but the list says "mean_squared_error". It's related to the fact that negative values come back ... http://d.hatena.ne.jp/teramonagi/20130825/1377434479#20130825f2

** Excerpt from description (quotation is the parameter value) ** The notation exactly matches the list ... It is a mystery that it does not match

Classification ‘accuracy’ metrics.accuracy_score ‘average_precision’ metrics.average_precision_score ‘f1’ metrics.f1_score for binary targets ‘f1_micro’ metrics.f1_score micro-averaged ‘f1_macro’ metrics.f1_score macro-averaged ‘f1_weighted’ metrics.f1_score weighted average ‘f1_samples’ metrics.f1_score by multilabel sample ‘neg_log_loss’ metrics.log_loss requires predict_proba support ‘precision’ etc. metrics.precision_score suffixes apply as with ‘f1’ ‘recall’ etc. metrics.recall_score suffixes 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

Recommended Posts

Setting of evaluation index for cross-validation (memo, scikit-learn, cross_validation.cross_val_score)
The pitfall of RMSE (Root Mean Square Error), the evaluation index for regression!