Update app.py
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ def huff_model_probability(df_distances, df_attractiveness, alpha, beta, df_popu
|
|
27 |
|
28 |
numerator = (attractiveness_term * distance_term).multiply(adjusted_population, axis=0)
|
29 |
denominator = numerator.sum(axis=1)
|
30 |
-
probabilities = numerator.div(denominator, axis=0)
|
31 |
|
32 |
return probabilities, adjustment_factors
|
33 |
|
@@ -75,8 +75,8 @@ def app_function(input_json):
|
|
75 |
|
76 |
# Prepare the output
|
77 |
output = {
|
78 |
-
"probabilities": probabilities
|
79 |
-
"adjustment_factors": adjustment_factors
|
80 |
}
|
81 |
|
82 |
return json.dumps(output)
|
|
|
27 |
|
28 |
numerator = (attractiveness_term * distance_term).multiply(adjusted_population, axis=0)
|
29 |
denominator = numerator.sum(axis=1)
|
30 |
+
probabilities = numerator.div(denominator, axis=0).fillna(0)
|
31 |
|
32 |
return probabilities, adjustment_factors
|
33 |
|
|
|
75 |
|
76 |
# Prepare the output
|
77 |
output = {
|
78 |
+
"probabilities": probabilities
|
79 |
+
"adjustment_factors": adjustment_factors
|
80 |
}
|
81 |
|
82 |
return json.dumps(output)
|