Untitled
unknown
plain_text
a year ago
1.4 kB
2
Indexable
import matplotlib.pyplot as plt import numpy as np # Line Chart model_accuracy1 = [0.75, 0.80, 0.85, 0.88, 0.90] model_accuracy2 = [0.70, 0.75, 0.88, 0.82, 0.85] epochs = [1, 2, 3, 4, 5] plt.figure(figsize=(10, 8)) plt.subplot(2, 2, 1) plt.plot(epochs, model_accuracy1, marker='>', label='Model 1') plt.plot(epochs, model_accuracy2, marker='+', label='Model 2') plt.title("Accuracy comparison of two models") plt.xlabel('Epochs') plt.ylabel('Accuracy') plt.legend() # Histogram data = [1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 8] plt.subplot(2, 2, 2) plt.hist(data, bins=8, edgecolor='black') plt.title("Histogram") plt.xlabel("Value") plt.ylabel("Frequency") # Pie Chart sizes = [20, 30, 25, 25] labels = ['A', 'B', 'C', 'D'] Page No. 30 plt.subplot(2, 2, 3) plt.pie(sizes, labels=labels, autopct='%1.1f%%') plt.title("Pie Chart") # Radar Chart plt.subplot(2, 2, 4, polar=True) # Number of variables num_vars = len(epochs) # Compute angle for each axis angles = np.linspace(0, 2 * np.pi, num_vars, endpoint=False).tolist() # Make the plot close to a circle model_accuracy1 += model_accuracy1[:1] model_accuracy2 += model_accuracy2[:1] angles += angles[:1] plt.plot(angles, model_accuracy1, marker='o', label='Model 1') plt.plot(angles, model_accuracy2, marker='o', label='Model 2') plt.title("Radar Chart") plt.legend() plt.tight_layout() plt.show()
Editor is loading...
Leave a Comment