prakharg24 commited on
Commit
a5e0476
·
verified ·
1 Parent(s): 0ec6255

Update my_pages/rashomon_effect.py

Browse files
Files changed (1) hide show
  1. my_pages/rashomon_effect.py +6 -5
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([800, 805, 970, 910, 708, 1020, 804, 880, 450, 501, 304, 470, 380, 309, 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,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
- y_line = slope * x + intercept
59
- ax.plot(x, y_line, color='blue')
60
- ax.fill_between(x, y_line, max(y), alpha=0.1, color='green')
61
- ax.fill_between(x, min(y), y_line, alpha=0.1, color='red')
 
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: