-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Closed
Description
Description
As brought up in #8737 (comment), linear_model.LogisticRegressionCV currently uses the dictionary metrics.SCORERS instead of the function metric.get_scorer to get scoring metrics. Using get_scorer yields the same result, but with a more helpful error message.
For example, the following code will fail because scoring='not-a-valid-scorer'
from sklearn.linear_model import LogisticRegressionCV
from sklearn.datasets import make_moons
X, y = make_moons()
LogisticRegressionCV(scoring='not-a-valid-scorer').fit(X, y)The current error message with SCORERS is
KeyError: 'not-a-valid-scorer'while the error message with get_scorer is
ValueError: 'not-a-valid-scorer' is not a valid scoring value. Valid options are ['accuracy',
'adjusted_mutual_info_score', 'adjusted_rand_score', 'average_precision', 'completeness_score',
'explained_variance', 'f1', 'f1_macro', 'f1_micro', 'f1_samples', 'f1_weighted', 'fowlkes_mallows_score',
'homogeneity_score', 'mutual_info_score', 'neg_log_loss', 'neg_mean_absolute_error',
'neg_mean_squared_error', 'neg_mean_squared_log_error', 'neg_median_absolute_error',
'normalized_mutual_info_score', 'precision', 'precision_macro', 'precision_micro', 'precision_samples',
'precision_weighted', 'r2', 'recall', 'recall_macro', 'recall_micro', 'recall_samples', 'recall_weighted',
'roc_auc', 'v_measure_score']Versions
Darwin-16.7.0-x86_64-i386-64bit
Python 3.6.1 |Continuum Analytics, Inc.| (default, May 11 2017, 13:04:09)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
NumPy 1.13.1
SciPy 0.19.1
Scikit-Learn 0.20.dev0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels