-
Notifications
You must be signed in to change notification settings - Fork 2
/
vessel_analysis.py
61 lines (50 loc) · 3.11 KB
/
vessel_analysis.py
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
53
54
55
56
57
58
59
60
import src.analysis as analysis
import src.plot_images as pli
import os
# fishing vessels
data_path = './data/crop/DCAIS_[30, 1001, 1002]_region_[37.6, 39, -122.9, -122.2]_01-04_to_30-06_trips.csv'
# tanker vessels
# data_path = './data/crop/DCAIS_[80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 1017, 1024]_region_[47.5, 49.3, -125.5, -122.5]_01-04_to_30-06_trips.csv'
# Measures: 'dtw', 'md', 'dfd', 'hd'
metric = 'hd'
# fishing = 2
# tanker = 3
mcs = 2
# path and folder for results
file_name = os.path.basename(data_path)
file_name = os.path.splitext(file_name)[0]
folder = f'./results/crop/{file_name}/{metric}/'
if not os.path.exists(folder):
os.makedirs(folder)
print(folder)
# Compression
rates_dp, times_dp = analysis.factor_analysis(data_path, 'DP', folder)
rates_tr, times_tr = analysis.factor_analysis(data_path, 'TR', folder)
rates_sp, times_sp = analysis.factor_analysis(data_path, 'SP', folder)
rates_tr_sp, times_tr_sp = analysis.factor_analysis(data_path, 'TR_SP', folder)
rates5_sp_tr, times_sp_tr = analysis.factor_analysis(data_path, 'SP_TR', folder)
rates6_sp_dp, times_sp_dp = analysis.factor_analysis(data_path, 'SP_DP', folder)
rates_dp_sp, times_dp_sp = analysis.factor_analysis(data_path, 'DP_SP', folder)
rates_tr_dp, times_tr_dp = analysis.factor_analysis(data_path, 'TR_DP', folder)
rates_dp_tr, times_dp_tr = analysis.factor_analysis(data_path, 'DP_TR', folder)
# Distance matrices
measure_dp = analysis.factor_dist_analysis(data_path, 'DP', folder, metric=metric)
measure_rt = analysis.factor_dist_analysis(data_path, 'TR', folder, metric=metric)
measure_sp = analysis.factor_dist_analysis(data_path, 'SP', folder, metric=metric)
measure_tr_sp = analysis.factor_dist_analysis(data_path, 'TR_SP', folder, metric=metric)
measure_sp_tr = analysis.factor_dist_analysis(data_path, 'SP_TR', folder, metric=metric)
measure_dp_sp = analysis.factor_dist_analysis(data_path, 'DP_SP', folder, metric=metric)
measure_sp_dp = analysis.factor_dist_analysis(data_path, 'SP_DP', folder, metric=metric)
measure_tr_dp = analysis.factor_dist_analysis(data_path, 'TR_DP', folder, metric=metric)
measure_dp_tr = analysis.factor_dist_analysis(data_path, 'DP_TR', folder, metric=metric)
# Clustering
measure_nmi = analysis.factor_cluster_analysis(data_path, 'DP', folder, metric=metric, mcs=mcs)
measure_nmi_tr = analysis.factor_cluster_analysis(data_path, 'TR', folder, metric=metric, mcs=mcs)
measure_nmi_sp = analysis.factor_cluster_analysis(data_path, 'SP', folder, metric=metric, mcs=mcs)
measure_nmi_tr_sp = analysis.factor_cluster_analysis(data_path, 'TR_SP', folder, metric=metric, mcs=mcs)
measure_nmi_sp_tr = analysis.factor_cluster_analysis(data_path, 'SP_TR', folder, metric=metric, mcs=mcs)
measure_nmi_dp_sp = analysis.factor_cluster_analysis(data_path, 'DP_SP', folder, metric=metric, mcs=mcs)
measure_nmi_sp_dp = analysis.factor_cluster_analysis(data_path, 'SP_DP', folder, metric=metric, mcs=mcs)
measure_nmi_tr_dp = analysis.factor_cluster_analysis(data_path, 'TR_DP', folder, metric=metric, mcs=mcs)
measure_nmi_dp_tr = analysis.factor_cluster_analysis(data_path, 'DP_TR', folder, metric=metric, mcs=mcs)
pli.lines_compression(folder, metric=metric)