Update my_pages/rashomon_effect.py
Browse files
my_pages/rashomon_effect.py
CHANGED
|
@@ -26,7 +26,7 @@ def render():
|
|
| 26 |
# labels = (income + credit > 100).astype(int) # 1 = paid back, 0 = default
|
| 27 |
|
| 28 |
income = np.array([80, 85, 97, 91, 78, 102, 84, 88, 45, 51, 34, 47, 38, 39, 97, 91, 38, 32])
|
| 29 |
-
credit = np.array([
|
| 30 |
labels = np.array([1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1])
|
| 31 |
|
| 32 |
colors = ['green' if label == 1 else 'red' for label in labels]
|
|
@@ -55,10 +55,11 @@ def render():
|
|
| 55 |
elif boundary_type == "slant":
|
| 56 |
slope = -10.677966 # From (94, 350) and (35, 980)
|
| 57 |
intercept = 1353.7288
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
ax.
|
| 61 |
-
ax.fill_between(
|
|
|
|
| 62 |
|
| 63 |
# Highlight specific point
|
| 64 |
if highlight_point is not None:
|
|
|
|
| 26 |
# labels = (income + credit > 100).astype(int) # 1 = paid back, 0 = default
|
| 27 |
|
| 28 |
income = np.array([80, 85, 97, 91, 78, 102, 84, 88, 45, 51, 34, 47, 38, 39, 97, 91, 38, 32])
|
| 29 |
+
credit = np.array([970, 880, 1020, 910, 805, 800, 804, 708, 470, 309, 450, 304, 380, 501, 370, 301, 1080, 902])
|
| 30 |
labels = np.array([1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1])
|
| 31 |
|
| 32 |
colors = ['green' if label == 1 else 'red' for label in labels]
|
|
|
|
| 55 |
elif boundary_type == "slant":
|
| 56 |
slope = -10.677966 # From (94, 350) and (35, 980)
|
| 57 |
intercept = 1353.7288
|
| 58 |
+
x_sorted = np.sort(x)
|
| 59 |
+
y_line = slope * x_sorted + intercept
|
| 60 |
+
ax.plot(x_sorted, y_line, color='blue')
|
| 61 |
+
ax.fill_between(x_sorted, y_line, max(y), alpha=0.1, color='green')
|
| 62 |
+
ax.fill_between(x_sorted, min(y), y_line, alpha=0.1, color='red')
|
| 63 |
|
| 64 |
# Highlight specific point
|
| 65 |
if highlight_point is not None:
|