jonathanjordan21 commited on
Commit
32b1dd3
·
verified ·
1 Parent(s): 0ea6454

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -28,6 +28,22 @@ REQUIRED_COLUMN_ORDER = [
28
  'num_viewpoint', 'num_jewelry_store'
29
  ]
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  def predict_score(lat, lon, api_key):
33
  # Convert input to tensor
@@ -73,7 +89,8 @@ def predict_score(lat, lon, api_key):
73
 
74
  # score = np.sigmoid(mu_pred2 - num_banks + 0.1) * 100
75
 
76
- score = 100 / (1 + np.exp(num_banks - mu_pred))
 
77
 
78
  # You can apply any post-processing here
79
  return (
 
28
  'num_viewpoint', 'num_jewelry_store'
29
  ]
30
 
31
+ def atm_score(num_atm, num_prediction_atm, k=7, pct=0.15):
32
+ # num_atm = np.asarray(num_atm, dtype=float)
33
+ # num_prediction_atm = np.asarray(num_prediction_atm, dtype=float)
34
+
35
+ # Avoid division by zero
36
+ eps = 1e-8
37
+ # num_atm = num_atm*(1 + pct)
38
+ num_prediction_atm = num_prediction_atm*(1 + pct)
39
+
40
+ # delta = (num_atm - num_prediction_atm) / (num_prediction_atm + eps)
41
+ delta = (num_prediction_atm - num_atm) / (num_atm + eps)
42
+
43
+ score = 100.0 / (1.0 + np.exp(-k * (delta)))
44
+ # score = 100 * np.exp( -k*delta ** 2 /( 300*(0.085)**2))
45
+ return score
46
+
47
 
48
  def predict_score(lat, lon, api_key):
49
  # Convert input to tensor
 
89
 
90
  # score = np.sigmoid(mu_pred2 - num_banks + 0.1) * 100
91
 
92
+ # score = 100 / (1 + np.exp(num_banks - mu_pred))
93
+ score = atm_score(num_banks, mu_pred)
94
 
95
  # You can apply any post-processing here
96
  return (