plot_confusion_matrix include_values
时间: 2024-01-19 13:01:53 浏览: 91
plot_confusion_keras_混淆矩阵_plotconfusion_
5星 · 资源好评率100%
`plot_confusion_matrix` is a function in the `sklearn.metrics` module that can be used to plot a confusion matrix. The `include_values` parameter is a boolean value that determines whether or not to display the count of each class in the confusion matrix.
If `include_values` is set to `True`, the count of each class will be displayed in each cell of the matrix. If `include_values` is set to `False`, the cells will be blank.
Here is an example of how to use `plot_confusion_matrix` with the `include_values` parameter set to `True`:
```python
from sklearn.metrics import plot_confusion_matrix
import matplotlib.pyplot as plt
# assume y_true and y_pred are already defined
confusion_matrix = confusion_matrix(y_true, y_pred)
plot_confusion_matrix(confusion_matrix, cmap=plt.cm.Blues, include_values=True)
plt.show()
```
This will display a confusion matrix with the count of each class in each cell.
阅读全文