-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmat_builder_cli.py
More file actions
52 lines (41 loc) · 2.04 KB
/
Copy pathmat_builder_cli.py
File metadata and controls
52 lines (41 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import pandas as pd
import geopandas as gpd
from core import Preprocessing, Segmentation, Enrichment
### MAIN application ###
def main() :
print('Executing preprocessing...')
params_preprocessing = {'trajectories' : pd.read_parquet('./datasets/rome/rome.parquet'),
'speed' : 300,
'n_points' : 1500,
'compress' : True}
prepro = Preprocessing()
prepro.execute(params_preprocessing)
print('Executing segmentation...')
params_segmentation = {'trajectories' : prepro.get_results()['preprocessed_trajectories'],
'duration' : 10,
'radius' : 0.2}
segm = Segmentation()
segm.execute(params_segmentation)
result_segmentation = segm.get_results()
print('Executing enrichment...')
enrichment = Enrichment()
poi_df = gpd.read_parquet('./datasets/rome/poi/pois.parquet')
social_df = pd.read_parquet('./datasets/rome/tweets/tweets_rome.parquet')
weather_df = pd.read_parquet('./datasets/rome/weather/weather_conditions.parquet')
params_enrichment = {'trajectories' : result_segmentation['trajectories'],
'moves' : result_segmentation['moves'],
'move_enrichment' : True,
'stops' : result_segmentation['stops'],
'poi_place' : 'Rome, Italy', # IGNORED, if path_poi is not None.
'poi_categories' : None, # ['amenity'], # IGNORED, if path_poi is not None.
'path_poi' : poi_df,
'max_dist' : 50,
'dbscan_epsilon' : 50,
'systematic_threshold' : 5,
'social_enrichment' : social_df,
"weather_enrichment" : weather_df,
'create_rdf' : True}
enrichment.execute(params_enrichment)
enrichment.get_results()['rdf_graph'].serialize_graph('kg.ttl')
if __name__ == '__main__':
main()