forked from TimeEval/TimeEval
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-experiment.py
More file actions
executable file
·146 lines (133 loc) · 3.71 KB
/
example-experiment.py
File metadata and controls
executable file
·146 lines (133 loc) · 3.71 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/env python3
import logging
import random
import sys
from pathlib import Path
from durations import Duration
from timeeval import TimeEval, DatasetManager, RemoteConfiguration, ResourceConstraints
from timeeval.metrics import RocAUC, RangeRocAUC, RangePrVUS
from timeeval_experiments.algorithm_configurator import AlgorithmConfigurator
from timeeval_experiments.algorithms import *
# Setup logging
logging.basicConfig(
filename="timeeval.log",
filemode="a",
level=logging.WARNING,
format="%(asctime)s %(levelname)6.6s - %(name)20.20s: %(message)s",
)
random.seed(42)
def main():
dm = DatasetManager(Path("tests/example_data"), create_if_missing=False)
configurator = AlgorithmConfigurator(config_path="timeeval_experiments/param-config.example.json")
# Select datasets and algorithms
datasets = dm.select()
datasets = random.sample(datasets, 1)
print(f"\nSelected datasets: {len(datasets)}")
algorithms = [
# arima(),
# autoencoder(),
# bagel(),
# cblof(),
# cof(),
# copod(),
# dae(),
# damp(),
# dbstream(),
# deepant(),
# deepnap(),
# donut(),
# dspot(),
dwt_mlead(),
# eif(),
# encdec_ad(),
# ensemble_gi(),
# fast_mcd(),
# fft(),
# generic_rf(),
# generic_xgb(),
# grammarviz3(),
# grammarviz3_multi(),
# hbos(),
# health_esn(),
# hif(),
# hotsax(),
# hybrid_knn(),
# if_lof(),
# iforest(),
# img_embedding_cae(),
# kmeans(),
# knn(),
# laser_dbn(),
# left_stampi(),
lof(),
# lstm_ad(),
# lstm_vae(),
# median_method(),
# mscred(),
# mstamp(),
# mtad_gat(),
# multi_hmm(),
# multi_subsequence_lof(),
# multinorma(),
# mvalmod(),
# norma(),
# normalizing_flows(),
# novelty_svr(),
# numenta_htm(),
# ocean_wnn(),
# omnianomaly(),
# pcc(),
# pci(),
# phasespace_svm(),
# pst(),
# random_black_forest(),
# robust_pca(),
# s_h_esd(),
# sand(),
# sarima(),
# series2graph(),
# sr(),
# sr_cnn(),
# ssa(),
# stamp(),
stomp(),
# subsequence_fast_mcd(),
# subsequence_if(),
# subsequence_knn(),
# subsequence_lof(),
# tanogan(),
# tarzan(),
# telemanom(),
# torsk(),
# triple_es(),
# ts_bitmap(),
# valmod(),
]
print(f"Selected algorithms: {len(algorithms)}")
configurator.configure(algorithms, ignore_dependent=False, perform_search=False)
print()
for algo in algorithms:
print(f"Algorithm {algo.name} param_grid:")
for config in algo.param_config.iter(algo, dataset=datasets[0]):
print(f" {config}")
sys.stdout.flush()
cluster_config = RemoteConfiguration(
scheduler_host="localhost",
worker_hosts=["localhost"]
)
limits = ResourceConstraints(
tasks_per_host=1,
task_cpu_limit=1.,
train_timeout=Duration("1 minute"),
execute_timeout=Duration("1 minute")
)
timeeval = TimeEval(dm, datasets, algorithms,
distributed=True,
remote_config=cluster_config,
resource_constraints=limits,
metrics=[RocAUC(), RangeRocAUC(buffer_size=100), RangePrVUS(max_buffer_size=100)]
)
timeeval.run()
print(timeeval.get_results(aggregated=False))
if __name__ == "__main__":
main()