Update utils.py
Browse files
utils.py
CHANGED
|
@@ -6,6 +6,7 @@ from scipy.spatial import cKDTree
|
|
| 6 |
df_amenities = pd.read_csv("df_amenities.csv")
|
| 7 |
df_banks = pd.read_csv("df_banks.csv")
|
| 8 |
|
|
|
|
| 9 |
bank_coords = df_banks[['lat','lon']].values
|
| 10 |
tree_banks = cKDTree(bank_coords)
|
| 11 |
|
|
@@ -13,11 +14,11 @@ amenity_coords = df_amenities[['lat','lon']].values
|
|
| 13 |
tree_amenities = cKDTree(amenity_coords)
|
| 14 |
|
| 15 |
DATASET_COLUMNS = [
|
| 16 |
-
'
|
| 17 |
-
'
|
| 18 |
-
'
|
| 19 |
-
'
|
| 20 |
-
'
|
| 21 |
]
|
| 22 |
|
| 23 |
def compute_features(candidate_point, radius=0.005):
|
|
@@ -25,6 +26,8 @@ def compute_features(candidate_point, radius=0.005):
|
|
| 25 |
|
| 26 |
# Banks
|
| 27 |
bank_idxs = tree_banks.query_ball_point([lat, lon], r=radius)
|
|
|
|
|
|
|
| 28 |
|
| 29 |
n_banks = len(bank_idxs)
|
| 30 |
if n_banks > 0:
|
|
|
|
| 6 |
df_amenities = pd.read_csv("df_amenities.csv")
|
| 7 |
df_banks = pd.read_csv("df_banks.csv")
|
| 8 |
|
| 9 |
+
|
| 10 |
bank_coords = df_banks[['lat','lon']].values
|
| 11 |
tree_banks = cKDTree(bank_coords)
|
| 12 |
|
|
|
|
| 14 |
tree_amenities = cKDTree(amenity_coords)
|
| 15 |
|
| 16 |
DATASET_COLUMNS = [
|
| 17 |
+
'Dining and Drinking', 'Community and Government', 'Retail',
|
| 18 |
+
'Business and Professional Services', 'Landmarks and Outdoors',
|
| 19 |
+
'Arts and Entertainment', 'Health and Medicine',
|
| 20 |
+
'Travel and Transportation', 'Sports and Recreation',
|
| 21 |
+
'Event'
|
| 22 |
]
|
| 23 |
|
| 24 |
def compute_features(candidate_point, radius=0.005):
|
|
|
|
| 26 |
|
| 27 |
# Banks
|
| 28 |
bank_idxs = tree_banks.query_ball_point([lat, lon], r=radius)
|
| 29 |
+
|
| 30 |
+
print("[BANK]", bank_idxs)
|
| 31 |
|
| 32 |
n_banks = len(bank_idxs)
|
| 33 |
if n_banks > 0:
|