Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 混淆矩阵Sklearn 0.22数字格式错误_Python_Machine Learning_Scikit Learn_Data Science_Confusion Matrix - Fatal编程技术网

Python 混淆矩阵Sklearn 0.22数字格式错误

Python 混淆矩阵Sklearn 0.22数字格式错误,python,machine-learning,scikit-learn,data-science,confusion-matrix,Python,Machine Learning,Scikit Learn,Data Science,Confusion Matrix,我试图使用sklearn 0.22中的plot_Mission_矩阵 但我的数字是1.3e+0.2格式 from sklearn.metrics import plot_confusion_matrix plt.figure(figsize=(100, 230)) plot_confusion_matrix(clf, X, y, cmap=plt.cm.Blues) plt.xlabel('True label') plt.ylabel('Predicted label') 如何解决此问题?

我试图使用sklearn 0.22中的plot_Mission_矩阵

但我的数字是1.3e+0.2格式

from sklearn.metrics import plot_confusion_matrix
plt.figure(figsize=(100, 230))
plot_confusion_matrix(clf, X, y, cmap=plt.cm.Blues)
plt.xlabel('True label')
plt.ylabel('Predicted label')


如何解决此问题?

在函数中使用value format参数

以下是使用值\格式参数的示例:

disp = plot_confusion_matrix(classifier, X_test, y_test,
                                 display_labels=class_names,
                                 cmap=plt.cm.Blues,
                                 normalize=normalize,
                                   values_format="d")

如果只想显示浮点值,可以使用以下格式“.1f”。这与seaborn中使用的value\u格式相同。

使用代码片段进行解释比使用代码图像更好。请提供value\u格式参数应如何使用的示例。那我就投你的票:)