Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -67,7 +67,7 @@ def compute_f1_score(cm):
|
|
| 67 |
f1 = np.nan_to_num(f1) # Replace NaN with 0
|
| 68 |
return np.mean(f1) # Return the mean F1-score across all classes
|
| 69 |
|
| 70 |
-
def plot_confusion_matrix_beamPred(cm, classes, title, save_path, theme=
|
| 71 |
# Compute the average F1-score
|
| 72 |
avg_f1 = compute_f1_score(cm)
|
| 73 |
|
|
@@ -86,10 +86,10 @@ def plot_confusion_matrix_beamPred(cm, classes, title, save_path, theme=None):
|
|
| 86 |
plt.figure(figsize=(10, 10))
|
| 87 |
|
| 88 |
# Plot the confusion matrix with a colormap compatible for the mode
|
| 89 |
-
sns.heatmap(cm, cmap=cmap, cbar=True, linecolor=
|
| 90 |
|
| 91 |
# Add F1-score to the title
|
| 92 |
-
plt.title(f"{title}\n(F1 Score: {avg_f1:.3f})", color=text_color, fontsize=
|
| 93 |
|
| 94 |
tick_marks = np.arange(len(classes))
|
| 95 |
plt.xticks(tick_marks, classes, color=text_color, fontsize=14) # Adjust text color based on the mode
|
|
|
|
| 67 |
f1 = np.nan_to_num(f1) # Replace NaN with 0
|
| 68 |
return np.mean(f1) # Return the mean F1-score across all classes
|
| 69 |
|
| 70 |
+
def plot_confusion_matrix_beamPred(cm, classes, title, save_path, theme='Light'):
|
| 71 |
# Compute the average F1-score
|
| 72 |
avg_f1 = compute_f1_score(cm)
|
| 73 |
|
|
|
|
| 86 |
plt.figure(figsize=(10, 10))
|
| 87 |
|
| 88 |
# Plot the confusion matrix with a colormap compatible for the mode
|
| 89 |
+
sns.heatmap(cm, cmap=cmap, cbar=True, linecolor=text_color, vmin=0, vmax=cm.max(), alpha=0.85)
|
| 90 |
|
| 91 |
# Add F1-score to the title
|
| 92 |
+
plt.title(f"{title}\n(F1 Score: {avg_f1:.3f})", color=text_color, fontsize=20)
|
| 93 |
|
| 94 |
tick_marks = np.arange(len(classes))
|
| 95 |
plt.xticks(tick_marks, classes, color=text_color, fontsize=14) # Adjust text color based on the mode
|