Closed
Description
Describe the bug
Let y_true and y_score be numpy arrays of shape (K,),
when you try to run the "sklearn.metrics.coverage_error" as explained in the documentation
it returns "binary type not supported" error, but this is not the case at all, the metric works with,
binary, the problem is it expects matrices of shape (1, K) if there is only one sample,
Please either fix the function so that it can work with 1D array or please fix the error message.
Steps/Code to Reproduce
coverage = np.mean([coverage_error(discrete_labels[i], discrete_scores[i]) - 1 for i in range(N)])
Expected Results
No error or, can not use 1D array error
Actual Results
raise ValueError("{0} format is not supported".format(y_type))
ValueError: binary format is not supported
Versions
>>> import sklearn; sklearn.show_versions()
System:
python: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:20:46) [GCC 9.4.0]
executable: /home/delivahit/anaconda3/envs/bugra/bin/python
machine: Linux-5.4.0-107-generic-x86_64-with-glibc2.27
Python dependencies:
pip: 21.2.4
setuptools: 58.0.4
sklearn: 1.0.2
numpy: 1.21.2
scipy: 1.7.2
Cython: None
pandas: 1.3.4
matplotlib: 3.5.0
joblib: 1.1.0
threadpoolctl: 3.0.0
Built with OpenMP: True