Fralet commited on
Commit
6946054
·
verified ·
1 Parent(s): 5f38853

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -78,6 +78,22 @@ from sklearn.metrics import accuracy_score, precision_recall_fscore_support, con
78
  data = pd.read_excel("ResponseOpenPredicted.xlsx")
79
  st.title("Resume-based Personality Prediction by Serikov Ayanbek")
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  # Function to calculate metrics
82
  def calculate_metrics(true_labels, predicted_labels):
83
  accuracy = accuracy_score(true_labels, predicted_labels)
@@ -100,10 +116,14 @@ def plot_confusion_matrix(conf_matrix, title):
100
  # Plotting function for distribution of predictions
101
  def plot_predictions_distribution(data, column, title):
102
  fig, ax = plt.subplots()
103
- sns.countplot(x=column, data=data, palette="viridis")
104
  plt.title(title)
105
  plt.xlabel('Predicted Labels')
106
  plt.ylabel('Count')
 
 
 
 
107
  st.pyplot(fig)
108
 
109
  # Streamlit app structure
 
78
  data = pd.read_excel("ResponseOpenPredicted.xlsx")
79
  st.title("Resume-based Personality Prediction by Serikov Ayanbek")
80
 
81
+ enneagram_types = {
82
+ "Peacemaker": "Peacemaker",
83
+ "Loyalist": "Loyalist",
84
+ "Achiever": "Achiever",
85
+ "Reformer": "Reformer",
86
+ "Individualist": "Individualist",
87
+ "Helper": "Helper",
88
+ "Challenger": "Challenger",
89
+ "Investigator": "Investigator",
90
+ "Enthusiast": "Enthusiast"
91
+ }
92
+
93
+ # Replace numeric or generic labels with descriptive Enneagram types
94
+ data['Predicted_F'] = data['Predicted_F'].map(enneagram_types)
95
+ data['Predicted_M'] = data['Predicted_M'].map(enneagram_types)
96
+
97
  # Function to calculate metrics
98
  def calculate_metrics(true_labels, predicted_labels):
99
  accuracy = accuracy_score(true_labels, predicted_labels)
 
116
  # Plotting function for distribution of predictions
117
  def plot_predictions_distribution(data, column, title):
118
  fig, ax = plt.subplots()
119
+ sns.countplot(x=column, data=data, palette="viridis", ax=ax)
120
  plt.title(title)
121
  plt.xlabel('Predicted Labels')
122
  plt.ylabel('Count')
123
+ plt.xticks(rotation=45) # Rotate labels for better readability
124
+ ax.xaxis.label.set_size(12)
125
+ ax.yaxis.label.set_size(12)
126
+ plt.subplots_adjust(bottom=0.15) # Adjust spacing to accommodate label rotation
127
  st.pyplot(fig)
128
 
129
  # Streamlit app structure