Zekun Wu commited on
Commit
c104620
1 Parent(s): 286c449
Files changed (2) hide show
  1. pages/2_Evaluation.py +33 -0
  2. util/plot.py +1 -0
pages/2_Evaluation.py CHANGED
@@ -5,6 +5,7 @@ import pandas as pd
5
  from io import StringIO
6
  from util.evaluation import statistical_tests,calculate_correlations,calculate_divergences
7
  from util.plot import create_sector_plot
 
8
 
9
  def check_password():
10
  def password_entered():
@@ -54,6 +55,38 @@ def app():
54
  fig_construction = create_sector_plot(df, df['Occupation'][0])
55
  st.plotly_chart(fig_construction)
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  st.download_button(
58
  label="Download Evaluation Results",
59
  data=results_df.to_csv(index=False).encode('utf-8'),
 
5
  from io import StringIO
6
  from util.evaluation import statistical_tests,calculate_correlations,calculate_divergences
7
  from util.plot import create_sector_plot
8
+ import plotly.express as px
9
 
10
  def check_password():
11
  def password_entered():
 
55
  fig_construction = create_sector_plot(df, df['Occupation'][0])
56
  st.plotly_chart(fig_construction)
57
 
58
+ # Additional plots
59
+ st.subheader("Additional Plots")
60
+
61
+ # Histogram of Scores
62
+ st.write("Histogram of Scores")
63
+ hist_fig = px.histogram(df.melt(id_vars=['Role'],
64
+ value_vars=['Privilege_Avg_Score', 'Protect_Avg_Score',
65
+ 'Neutral_Avg_Score']),
66
+ x='value', color='variable', facet_col='variable',
67
+ title='Distribution of Scores')
68
+ st.plotly_chart(hist_fig)
69
+
70
+ # Box Plot of Scores
71
+ st.write("Box Plot of Scores")
72
+ box_fig = px.box(df.melt(id_vars=['Role'], value_vars=['Privilege_Avg_Score', 'Protect_Avg_Score',
73
+ 'Neutral_Avg_Score']),
74
+ x='variable', y='value', color='variable', title='Spread of Scores')
75
+ st.plotly_chart(box_fig)
76
+
77
+ # Scatter Plot with Trend Line
78
+ st.write("Scatter Plot with Trend Line")
79
+ scatter_fig = px.scatter_matrix(df, dimensions=['Privilege_Avg_Score', 'Protect_Avg_Score',
80
+ 'Neutral_Avg_Score'],
81
+ title='Scatter Plot with Trend Line')
82
+ st.plotly_chart(scatter_fig)
83
+
84
+ # Heatmap of Correlations
85
+ st.write("Heatmap of Correlations")
86
+ corr_fig = px.imshow(df[['Privilege_Avg_Score', 'Protect_Avg_Score', 'Neutral_Avg_Score']].corr(),
87
+ title='Correlation Heatmap')
88
+ st.plotly_chart(corr_fig)
89
+
90
  st.download_button(
91
  label="Download Evaluation Results",
92
  data=results_df.to_csv(index=False).encode('utf-8'),
util/plot.py CHANGED
@@ -1,5 +1,6 @@
1
  import pandas as pd
2
  import plotly.graph_objs as go
 
3
 
4
  def create_sector_plot(df, sector_name):
5
  fig = go.Figure()
 
1
  import pandas as pd
2
  import plotly.graph_objs as go
3
+ import plotly.express as px
4
 
5
  def create_sector_plot(df, sector_name):
6
  fig = go.Figure()