Update my_pages/rashomon_effect.py
Browse files- my_pages/rashomon_effect.py +7 -11
my_pages/rashomon_effect.py
CHANGED
|
@@ -39,24 +39,22 @@ def render():
|
|
| 39 |
ax.scatter(*highlight_point, c='yellow', edgecolors='black', s=200, zorder=5)
|
| 40 |
|
| 41 |
ax.spines['right'].set_visible(False)
|
| 42 |
-
ax.spines['
|
| 43 |
ax.set_xticks([])
|
| 44 |
ax.set_yticks([])
|
| 45 |
|
| 46 |
return fig
|
| 47 |
|
| 48 |
# Top scatter plot (centered to match smaller width)
|
| 49 |
-
col1, col2, col3 = st.columns([1,
|
| 50 |
-
with
|
| 51 |
st.pyplot(plot_scatter(income, credit, colors, title="Original Data"))
|
| 52 |
|
| 53 |
-
|
| 54 |
-
col_left, col_right = st.columns(2)
|
| 55 |
-
with col_left:
|
| 56 |
st.pyplot(plot_scatter(income, credit, colors, title="Vertical Boundary",
|
| 57 |
decision_boundary=55, boundary_type="vertical"))
|
| 58 |
left_selected = st.button("Choose Vertical Boundary")
|
| 59 |
-
with
|
| 60 |
st.pyplot(plot_scatter(income, credit, colors, title="Horizontal Boundary",
|
| 61 |
decision_boundary=55, boundary_type="horizontal"))
|
| 62 |
right_selected = st.button("Choose Horizontal Boundary")
|
|
@@ -64,8 +62,7 @@ def render():
|
|
| 64 |
# Show new individual based on selection
|
| 65 |
if left_selected:
|
| 66 |
new_point = (40, 80) # High credit score, low income
|
| 67 |
-
|
| 68 |
-
with col2:
|
| 69 |
st.pyplot(plot_scatter(income, credit, colors,
|
| 70 |
title="Vertical Boundary + New Individual",
|
| 71 |
decision_boundary=55, boundary_type="vertical",
|
|
@@ -73,8 +70,7 @@ def render():
|
|
| 73 |
st.warning("This individual was rejected by your chosen model. Why not choose a model that helps them?")
|
| 74 |
elif right_selected:
|
| 75 |
new_point = (80, 40) # Low credit score, high income
|
| 76 |
-
|
| 77 |
-
with col2:
|
| 78 |
st.pyplot(plot_scatter(income, credit, colors,
|
| 79 |
title="Horizontal Boundary + New Individual",
|
| 80 |
decision_boundary=55, boundary_type="horizontal",
|
|
|
|
| 39 |
ax.scatter(*highlight_point, c='yellow', edgecolors='black', s=200, zorder=5)
|
| 40 |
|
| 41 |
ax.spines['right'].set_visible(False)
|
| 42 |
+
ax.spines['top'].set_visible(False)
|
| 43 |
ax.set_xticks([])
|
| 44 |
ax.set_yticks([])
|
| 45 |
|
| 46 |
return fig
|
| 47 |
|
| 48 |
# Top scatter plot (centered to match smaller width)
|
| 49 |
+
col1, col2, col3, col4, col5 = st.columns([1, 1, 1, 1, 1])
|
| 50 |
+
with col3:
|
| 51 |
st.pyplot(plot_scatter(income, credit, colors, title="Original Data"))
|
| 52 |
|
| 53 |
+
with col2:
|
|
|
|
|
|
|
| 54 |
st.pyplot(plot_scatter(income, credit, colors, title="Vertical Boundary",
|
| 55 |
decision_boundary=55, boundary_type="vertical"))
|
| 56 |
left_selected = st.button("Choose Vertical Boundary")
|
| 57 |
+
with col4:
|
| 58 |
st.pyplot(plot_scatter(income, credit, colors, title="Horizontal Boundary",
|
| 59 |
decision_boundary=55, boundary_type="horizontal"))
|
| 60 |
right_selected = st.button("Choose Horizontal Boundary")
|
|
|
|
| 62 |
# Show new individual based on selection
|
| 63 |
if left_selected:
|
| 64 |
new_point = (40, 80) # High credit score, low income
|
| 65 |
+
with col3:
|
|
|
|
| 66 |
st.pyplot(plot_scatter(income, credit, colors,
|
| 67 |
title="Vertical Boundary + New Individual",
|
| 68 |
decision_boundary=55, boundary_type="vertical",
|
|
|
|
| 70 |
st.warning("This individual was rejected by your chosen model. Why not choose a model that helps them?")
|
| 71 |
elif right_selected:
|
| 72 |
new_point = (80, 40) # Low credit score, high income
|
| 73 |
+
with col3:
|
|
|
|
| 74 |
st.pyplot(plot_scatter(income, credit, colors,
|
| 75 |
title="Horizontal Boundary + New Individual",
|
| 76 |
decision_boundary=55, boundary_type="horizontal",
|