Spaces:
Sleeping
Sleeping
nastasiasnk
commited on
Commit
•
0b6419d
1
Parent(s):
4f0e724
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,9 @@ def test(input_json):
|
|
20 |
weights = inputs['input']["weights"]
|
21 |
|
22 |
alpha = inputs['input']["alpha"]
|
|
|
23 |
threshold = inputs['input']["threshold"]
|
|
|
24 |
|
25 |
#print("Parsed input keys:", inputs.keys())
|
26 |
|
@@ -31,22 +33,24 @@ def test(input_json):
|
|
31 |
#multiplier_series = pd.Series(float(inputs["a_list"]), index=inputs["dataframe"].index)
|
32 |
#new_df["new column"] = float(inputs["dataframe"]).mul(multiplier_series, axis=0)
|
33 |
|
34 |
-
|
|
|
35 |
|
36 |
"""
|
37 |
-
def computeAccessibility (DistanceMatrix,destinationWeights, alpha = 0.0038,
|
38 |
|
39 |
decay_factors = np.exp(-alpha * DistanceMatrix) * (DistanceMatrix <= threshold)
|
40 |
subdomainsAccessibility = pd.DataFrame(index=DistanceMatrix.index, columns=destinationWeights.columns)
|
41 |
for col in destinationWeights.columns:
|
42 |
subdomainsAccessibility[col] = (decay_factors * destinationWeights[col].values).sum(axis=1)
|
43 |
|
44 |
-
subdomainsAccessibility.drop(columns='commercial', inplace=True)
|
45 |
return subdomainsAccessibility
|
46 |
"""
|
47 |
|
48 |
-
|
49 |
-
|
|
|
50 |
|
51 |
# Prepare the output
|
52 |
output = {
|
|
|
20 |
weights = inputs['input']["weights"]
|
21 |
|
22 |
alpha = inputs['input']["alpha"]
|
23 |
+
alpha = float(alpha)
|
24 |
threshold = inputs['input']["threshold"]
|
25 |
+
threshold = float(threshold)
|
26 |
|
27 |
#print("Parsed input keys:", inputs.keys())
|
28 |
|
|
|
33 |
#multiplier_series = pd.Series(float(inputs["a_list"]), index=inputs["dataframe"].index)
|
34 |
#new_df["new column"] = float(inputs["dataframe"]).mul(multiplier_series, axis=0)
|
35 |
|
36 |
+
#df_matrix = pd.DataFrame(matrix).T
|
37 |
+
#df_weights = pd.DataFrame(weights).T
|
38 |
|
39 |
"""
|
40 |
+
def computeAccessibility (DistanceMatrix,destinationWeights, alpha = 0.0038, threshold = 600):
|
41 |
|
42 |
decay_factors = np.exp(-alpha * DistanceMatrix) * (DistanceMatrix <= threshold)
|
43 |
subdomainsAccessibility = pd.DataFrame(index=DistanceMatrix.index, columns=destinationWeights.columns)
|
44 |
for col in destinationWeights.columns:
|
45 |
subdomainsAccessibility[col] = (decay_factors * destinationWeights[col].values).sum(axis=1)
|
46 |
|
47 |
+
#subdomainsAccessibility.drop(columns='commercial', inplace=True)
|
48 |
return subdomainsAccessibility
|
49 |
"""
|
50 |
|
51 |
+
#subdomainsAccessibility = computeAccessibility(df_matrix,df_weights,alpha,threshold)
|
52 |
+
|
53 |
+
#subdomainsAccessibility_dict = subdomainsAccessibility.to_dict('index')
|
54 |
|
55 |
# Prepare the output
|
56 |
output = {
|