Google colab 中的混淆矩阵被截断
Confusion matrix in Google colab is cutted off
我尝试通过以下代码可视化我的混淆矩阵:
from mlxtend.plotting import plot_confusion_matrix
import matplotlib.pyplot as plt
import numpy as np
import sklearn as skplt
import scikitplot as skplt
skplt.metrics.plot_confusion_matrix(y_val, autokeras_predictions, figsize = (5, 5), title= 'My confusionmatrix' )
plt.figure(figsize = (10,7))
但它切断了我上下的混淆矩阵。 (见图)
谁能帮帮我?谢谢!
我遇到了同样的问题。
我在 Windows 上使用 Anaconda
。
对我来说,以下解决了问题:
from mlxtend.plotting import plot_confusion_matrix
...
multiclass = confusion_matrix(test_y, predictions)
class_names = ['16QAM', '32QAM', '64QAM', 'BPSK', 'QPSK', '8PSK']
fig, ax = plot_confusion_matrix(conf_mat=multiclass, colorbar=True,
show_absolute=False, show_normed=True, class_names=class_names)
-->ax.margins(2,2) #just change the values til adjust to your screen.
plt.show()
我尝试通过以下代码可视化我的混淆矩阵:
from mlxtend.plotting import plot_confusion_matrix
import matplotlib.pyplot as plt
import numpy as np
import sklearn as skplt
import scikitplot as skplt
skplt.metrics.plot_confusion_matrix(y_val, autokeras_predictions, figsize = (5, 5), title= 'My confusionmatrix' )
plt.figure(figsize = (10,7))
但它切断了我上下的混淆矩阵。 (见图)
谁能帮帮我?谢谢!
我遇到了同样的问题。
我在 Windows 上使用 Anaconda
。
对我来说,以下解决了问题:
from mlxtend.plotting import plot_confusion_matrix
...
multiclass = confusion_matrix(test_y, predictions)
class_names = ['16QAM', '32QAM', '64QAM', 'BPSK', 'QPSK', '8PSK']
fig, ax = plot_confusion_matrix(conf_mat=multiclass, colorbar=True,
show_absolute=False, show_normed=True, class_names=class_names)
-->ax.margins(2,2) #just change the values til adjust to your screen.
plt.show()