diff --git a/sklearn/metrics/classification.py b/sklearn/metrics/classification.py index e5ab5b49fcefbfcf334eaa3519f00c441f8c1f1c..09aa4d87b8e21079696b8417d850c9a2868678c3 100644 --- a/sklearn/metrics/classification.py +++ b/sklearn/metrics/classification.py @@ -77,8 +77,8 @@ def _check_targets(y_true, y_pred): y_type = set(["multiclass"]) if len(y_type) > 1: - raise ValueError("Can't handle mix of {0} and {1}" - "".format(type_true, type_pred)) + raise ValueError("Classification metrics can't handle a mix of {0} " + "and {1} targets".format(type_true, type_pred)) # We can't have more than one value on y_type => The set is no more needed y_type = y_type.pop() diff --git a/sklearn/metrics/tests/test_classification.py b/sklearn/metrics/tests/test_classification.py index e2acf1de592ad43e3f0c80738cf5e9350f7c88cc..4d6b87f701ea442e4e5412b34494cef63af236e3 100644 --- a/sklearn/metrics/tests/test_classification.py +++ b/sklearn/metrics/tests/test_classification.py @@ -1344,7 +1344,8 @@ def test__check_targets(): if type1 != type2: assert_raise_message( ValueError, - "Can't handle mix of {0} and {1}".format(type1, type2), + "Classification metrics can't handle a mix of {0} and {1} " + "targets".format(type1, type2), _check_targets, y1, y2) else: diff --git a/sklearn/metrics/tests/test_common.py b/sklearn/metrics/tests/test_common.py index d0b855d278e95c117e459afbe968e27886c4a186..5f775aaf9ac8f5e6cd5843eff7b6d7ec80e6a0c1 100644 --- a/sklearn/metrics/tests/test_common.py +++ b/sklearn/metrics/tests/test_common.py @@ -636,7 +636,8 @@ def test_inf_nan_input(): for metric in CLASSIFICATION_METRICS.values(): for y_true, y_score in invalids: assert_raise_message(ValueError, - "Can't handle mix of binary and continuous", + "Classification metrics can't handle a mix " + "of binary and continuous targets", metric, y_true, y_score)