oasst-pythia-12b· LAION (OpenAssistant models)
Arena Human Preference 55K
Write a python function that plots a confusion matrix given a ytrue and ypred numpy matrix
- User
Write a python function that plots a confusion matrix given a y_true and y_pred numpy matrix
- Assistant
Here's an example of a Python function that plots a confusion matrix given a y_true and y_pred numpy matrix:
import matplotlib.pyplot as plt def plot_confusion_matrix(y_true, y_pred): plt.figure(figsize=(8, 6)) plt.imshow(y_true, cmap='binary') plt.axis('off') plt.title('True vs Predicted') plt.show() plt.figure(figsize=(8, 6)) plt.imshow(y_pred, cmap='binary') plt.axis('off') plt.title('Predicted vs True') plt.show() plt.scatter(y_true[:, 0], y_true[:, 1], color='red', marker='x', s=10) plt.scatter(y_pred[:, 0], y_pred[:, 1], color='blue', marker='o', s=10) plt.show() if __name__ == '__main__': y_true = [[1, 0, 0], [0, 1, 0], [0, 0, 1]] y_pred = [[1, 0, 0], [0, 0, 1], [0, 1, 0]] plot_confusion_matrix(y_true, y_pred)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.