sepandhaghighi / pycm

Multi-class confusion matrix library in Python
http://pycm.io
MIT License
1.45k stars 124 forks source link

Decimal points in plot method #451

Open tanjiu opened 2 years ago

tanjiu commented 2 years ago

Description

百分比的混淆矩阵计算出来的位数太长,保存下来的图片数据是重合的,请问是否有办法设置一下小数点位数?真的十分感谢解答!!! image

Steps/Code to Reproduce

这是我的代码: cm = ConfusionMatrix(actual_vector=y_trueLabel, predict_vector=y_predictLabel, digit=4) cm.plot(cmap=plt.cm.Reds, normalized=True, number_label=True, plot_lib="matplotlib")
plt.xticks(rotation=45) plt.savefig(fname="C:\Users\Graduate01\Desktop\222\%s" % '235')

Expected Behavior

Actual Behavior

Operating System

Python Version

PyCM Version (Use : pycm.__version__)

sadrasabouri commented 2 years ago

I wonder if we wanted to add this particular feature in the near future, right @sepandhaghighi ?

tanjiu commented 2 years ago

我想知道我们是否想在不久的将来添加这个特殊功能,对吧@sepandhaghighi?

如果可以的话,可不可以再调整一下画出来的混淆矩阵的重叠问题,我发现在类别较多的时候显示还是会重叠,例如下面这样: image

sadrasabouri commented 2 years ago

This is another issue. We should take care of it, too.

sepandhaghighi commented 2 years ago

I wonder if we wanted to add this particular feature in the near future, right @sepandhaghighi ?

This is a bug that we have to fix one day. But I also think that we will work on it in the next 3- 4 versions.

Similar to #430

sepandhaghighi commented 2 years ago

This is another issue. We should take care of it, too.

I think in problems with a large number of classes, it is not possible to display the numbers in the table (like Example 7). This is not a PyCM problem. Do you have any idea?

sadrasabouri commented 2 years ago

It may be a good workaround if we add a parameter for font size. This would help us.

tanjiu commented 2 years ago

这是另一个问题。我们也应该照顾它。

我认为在有大量类的问题中,不可能在表格中显示数字(如示例 7)。这不是 PyCM 问题。 你有什么主意吗?

我的混淆矩阵用18类进行测试的,然后我发现如果可以把plot.show()的图片最大化,基本上可以正常显示,百分比的图只需要控制一下小数点位数就可以了,不过这需要每次都要手动点击右上角的最大化按钮,我之前曾经尝试过自动将图片最大化保存,但是最终没有成功,我想你们可不可以加一个最大化显示图片的功能,这样就完美了,我的编程能力实在是太菜了,不得已向你们提出这个请求,非常感谢如果你们能够接受这个建议的话。最大化图片的实际显示效果如下: image 194a5d6e376d6e51000eeb7e4404236

@sadrasabouri

sepandhaghighi commented 2 years ago

It may be a good workaround if we add a parameter for font size. This would help us.

Nice approach! We should test it.

tanjiu commented 2 years ago

如果我们为字体大小添加一个参数,这可能是一个很好的解决方法。这会对我们有所帮助。

不错的方法!我们应该对其进行测试。

我认为让图片最大化保存也是一个更合适的方法,这样可以避免字体过小显示效果不好的情况