Spaces:
Sleeping
Sleeping
Create visualizations.py
Browse files- utils/visualizations.py +19 -0
utils/visualizations.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import matplotlib.pyplot as plt
|
| 2 |
+
import seaborn as sns
|
| 3 |
+
|
| 4 |
+
def plot_correlation_heatmap(df):
|
| 5 |
+
corr = df.corr()
|
| 6 |
+
plt.figure(figsize=(10, 8))
|
| 7 |
+
sns.heatmap(corr, annot=True, cmap="coolwarm", fmt=".2f", cbar=True)
|
| 8 |
+
plt.show()
|
| 9 |
+
|
| 10 |
+
def plot_model_performance(metrics_df):
|
| 11 |
+
metrics_df.set_index('Model', inplace=True)
|
| 12 |
+
ax = metrics_df.plot(kind='bar', figsize=(10, 6), colormap='coolwarm', rot=45)
|
| 13 |
+
plt.title("Model Performance Metrics")
|
| 14 |
+
plt.ylabel("Scores")
|
| 15 |
+
plt.xlabel("Models")
|
| 16 |
+
plt.show()
|
| 17 |
+
|
| 18 |
+
def save_plot_as_png(fig, filename):
|
| 19 |
+
fig.savefig(filename, format="png")
|