Update app.py
Browse files
app.py
CHANGED
|
@@ -56,20 +56,23 @@ def main():
|
|
| 56 |
plot_prediction_graphs(all_data)
|
| 57 |
|
| 58 |
def plot_prediction_graphs(data):
|
| 59 |
-
# Function to plot graphs for predictions
|
| 60 |
for model_name in models.keys():
|
| 61 |
-
plt.
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
if __name__ == "__main__":
|
| 75 |
main()
|
|
|
|
| 56 |
plot_prediction_graphs(all_data)
|
| 57 |
|
| 58 |
def plot_prediction_graphs(data):
|
| 59 |
+
# Function to plot graphs for predictions, divided by prediction value
|
| 60 |
for model_name in models.keys():
|
| 61 |
+
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(16, 6), sharey=True)
|
| 62 |
+
for prediction_val in [0, 1]:
|
| 63 |
+
ax = ax1 if prediction_val == 0 else ax2
|
| 64 |
+
filtered_data = {seq: values[model_name] for seq, values in data.items() if values[model_name][0] == prediction_val}
|
| 65 |
+
# Sorting sequences based on confidence, descending
|
| 66 |
+
sorted_sequences = sorted(filtered_data.items(), key=lambda x: x[1][1], reverse=True)
|
| 67 |
+
sequences = [x[0] for x in sorted_sequences]
|
| 68 |
+
conf_values = [x[1][1] for x in sorted_sequences]
|
| 69 |
+
sns.barplot(x=sequences, y=conf_values, palette="coolwarm" if prediction_val == 0 else "cubehelix", ax=ax)
|
| 70 |
+
ax.set_title(f'Confidence Scores for {model_name.capitalize()} (Prediction {prediction_val})')
|
| 71 |
+
ax.set_xlabel('Sequences')
|
| 72 |
+
ax.set_ylabel('Confidence')
|
| 73 |
+
ax.tick_params(axis='x', rotation=45) # Rotate x labels for better visibility
|
| 74 |
+
|
| 75 |
+
st.pyplot(fig) # Display the plot with two subplots below the results table
|
| 76 |
|
| 77 |
if __name__ == "__main__":
|
| 78 |
main()
|