-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Description
Description
sklearn.metrics.precision_score gives 0.0 when class is 0 only.
Steps/Code to Reproduce
Example:
from sklearn import metrics
y = [0,0,0]
y_pred = [0,0,0]
print(metrics.precision_score(y, y_pred)) # returns 0.0
Expected Results
The expected result should be 1.0 because all the values are the same.
Actual Results
The actual result is 0.0
Versions
/usr/local/lib/python3.6/dist-packages/numpy/distutils/system_info.py:625: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
self.calc_info()
/usr/local/lib/python3.6/dist-packages/numpy/distutils/system_info.py:625: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
self.calc_info()
/usr/local/lib/python3.6/dist-packages/numpy/distutils/system_info.py:625: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
self.calc_info()
System
python: 3.6.6 (default, Sep 12 2018, 18:26:19) [GCC 8.0.1 20180414 (experimental) [trunk revision
259383]]
executable: /usr/local/bin/python
machine: Linux-4.4.0-17763-Microsoft-x86_64-with-Ubuntu-18.04-bionic
BLAS
macros:
lib_dirs:
cblas_libs: cblas
Python deps
pip: 18.0
setuptools: 39.2.0
sklearn: 0.20.0
numpy: 1.15.2
scipy: 1.1.0
Cython: 0.28.3
pandas: 0.23.1
I would be happy to help fix this if folks want. For now, I'm just going to check if all values are zero and if they are, I'll return 1.0 Thanks!