【问题标题】:pandas_ml change confusion matrix image sizepandas_ml 改变混淆矩阵图像大小
【发布时间】:2018-11-27 11:37:02
【问题描述】:

如何增加具有大量类别的pandas_ml 混淆矩阵图像的大小,以便标签清晰可见?

这样的图像可以像这样在 Jupyter 中生成:

import pandas as pd
from pandas_ml import ConfusionMatrix
import matplotlib.pyplot as plt
import string
%matplotlib inline

classes = string.printable # 100 target classes
df = pd.DataFrame({'true':list(classes*10),
                   'pred':sorted(classes*2)+list(classes*8)
                  })
cm = ConfusionMatrix(df['true'],df['pred'])
cm.plot()

我尝试了涉及changing figure sizessubfigure sizes 的各种建议,以及在pandas_ml docs 中寻找sizewidth 但没有任何效果远。

【问题讨论】:

    标签: python pandas matplotlib pandas-ml


    【解决方案1】:

    用途:

    plt.figure(figsize=(20,20))

    cm.plot(normalized=True, backend="seaborn")

    【讨论】:

    • 再解释一下为什么这会解决问题会很好。
    • 确认这确实有效,但仅当后端为 seaborn 时。这是为什么呢?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-26
    • 2017-02-18
    • 2020-02-23
    • 2018-11-22
    • 1970-01-01
    • 2021-07-21
    相关资源
    最近更新 更多