prakharg24 commited on
Commit
f0db6f0
·
verified ·
1 Parent(s): 3b8b689

Update my_pages/multiverse.py

Browse files
Files changed (1) hide show
  1. my_pages/multiverse.py +15 -17
my_pages/multiverse.py CHANGED
@@ -1,7 +1,7 @@
1
  # pages/multiverse.py
2
  import streamlit as st
3
  import plotly.graph_objects as go
4
- from utils import add_navigation, add_instruction_text
5
 
6
  import random
7
  import pandas as pd
@@ -116,8 +116,8 @@ def render():
116
 
117
  add_instruction_text(
118
  """
119
- Explore the multiverse of models visually.<br>
120
- Make a choice, and the corresponding model will be trained for you.
121
  """
122
  )
123
 
@@ -260,17 +260,15 @@ def render():
260
  placeholder.write("Training your model.")
261
  model.fit(X_train, y_train)
262
  placeholder.empty()
263
-
264
- acc = model.score(X_test, y_test)
265
-
266
- acc_men = model.score(X_test[group_test==1], y_test[group_test==1])
267
- acc_women = model.score(X_test[group_test==0], y_test[group_test==0])
268
-
269
- disp = abs(acc_men - acc_women)
270
-
271
- st.subheader("📊 Model Performance Metrics")
272
- st.markdown(f"""
273
- Your model was tested on a separate test dataset, and you achieved the following overall model accuracy as well as disparity in accuracy across men and women in the dataset.
274
- """)
275
- st.metric(label="Model Accuracy", value=f"{acc * 100:.1f}%")
276
- st.metric(label="Gender Disparity in Accuracy", value=f"{disp * 100:.1f}%")
 
1
  # pages/multiverse.py
2
  import streamlit as st
3
  import plotly.graph_objects as go
4
+ from utils import add_navigation, add_instruction_text, add_red_text
5
 
6
  import random
7
  import pandas as pd
 
116
 
117
  add_instruction_text(
118
  """
119
+ Visually explore the multiverse of AI models to judge loan applications.<br>
120
+ Make a choice, and scroll down to see the properties of the trained model.
121
  """
122
  )
123
 
 
260
  placeholder.write("Training your model.")
261
  model.fit(X_train, y_train)
262
  placeholder.empty()
263
+
264
+ y_pred = model.predict(X_test)
265
+
266
+ uniq_perc = 10.5
267
+ add_red_text(f"""
268
+ Your chosen model rejected {uniq_perc}% loans that would have been accepted by more than 90% of the other models.<br><br>
269
+ You might want a higher value here, as you will not be competiting for the same loan applicants with others, and will give a chance to unique applicants.
270
+ In other words, you are concerned about homogenization and are trying to avoid it.<br><br>
271
+ On the other hand, you might instead want a lower value here, as you will be taking lower risks and giving loans to only applicants who are highly likely to repay.
272
+ Moreover, you do not have to face a justification crisis, where you cannot explain why certain applicants were rejected when they were accepted by everyone else.
273
+ In other words, you are concerned about arbitrariness and are trying to avoid it.<br><br>
274
+ """)