Update my_pages/multiverse.py
Browse files- 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 |
-
|
| 120 |
-
Make a choice, and
|
| 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 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 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 |
+
""")
|
|
|
|
|
|