metriculous-ml / metriculous

Measure and visualize machine learning model performance without the usual boilerplate.
MIT License
94 stars 11 forks source link

Show numbers on confusion matrix #1

Closed davidggphy closed 4 years ago

davidggphy commented 4 years ago

First, thanks for the library, it's really cool.

I only obtain the plots until the "scatter confusion matrix", I get the following error:

python3.8/site-packages/metriculous/evaluators/_classification_figures_bokeh.py:161: RuntimeWarning: invalid value encountered in true_divide
  cm_normalized_by_pred = cm.astype("float") / cm.sum(axis=0, keepdims=True)

This happens every time I have a model which NEVER predicts one of the classes. E.g.: a naive model always predicting the majority class.

Also, there would be nice to have an option that allows to show the numbers directly on the confusion matrix, without the need of hovering over it.

marlonjan commented 4 years ago

Hi @davidggphy, thanks for trying out this library and reporting the issue. What happens there is a division by zero, and I assume that after that warning you got an "Out of range float values are not JSON compliant" error. I just pushed a fix for the serialization issue to master, it will be included in the next release.

For now, if you install that unreleased version with

$ pip install git+https://github.com/metriculous-ml/metriculous.git@master

you should see something like this:

image

You will still see the "invalid value encountered in true_divide" warning, that is something I should also address soon.

would be nice to have an option that allows to show the numbers directly on the confusion matrix, without the need of hovering over it

Yes, I agree 👍 Especially since these kinds of diagrams tend to get shared as screenshots a lot.

marlonjan commented 4 years ago

New look for the confusion matrices is on develop (pip install git+https://github.com/metriculous-ml/metriculous.git@develop): image

davidggphy commented 4 years ago

thanks for the good work!