-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathexample-experiment.py
136 lines (121 loc) · 3.48 KB
/
example-experiment.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
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
#!/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, DefaultMetrics
from timeeval.constants import HPI_CLUSTER
from timeeval_experiments.algorithm_configurator import AlgorithmConfigurator
from timeeval_experiments.algorithms import *
# Setup logging
logging.basicConfig(
filename="timeeval.log",
filemode="a",
level=logging.INFO,
force=True,
format="%(asctime)s %(levelname)6.6s - %(name)20.20s: %(message)s",
)
random.seed(42)
def main():
# dm = DatasetManager(HPI_CLUSTER.akita_benchmark_path, create_if_missing=False)
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"Selected datasets: {len(datasets)}")
algorithms = [
# generic_rf(),
norma(),
# sr_cnn(),
# knn(),
# cblof(),
# hif(),
# fft(),
# dbstream(),
# img_embedding_cae(),
# telemanom(),
# dwt_mlead(),
# stamp(),
# grammarviz3(),
# hybrid_knn(),
# normalizing_flows(),
# ts_bitmap(),
# lof(),
# deepnap(),
# multi_hmm(),
# iforest(),
# valmod(),
# sarima(),
# dspot(),
# ssa(),
# kmeans(),
# hbos(),
# encdec_ad(),
# numenta_htm(),
# pcc(),
# novelty_svr(),
# ensemble_gi(),
# series2graph(),
# mscred(),
# copod(),
# median_method(),
# arima(),
# torsk(),
# tarzan(),
# if_lof(),
# cof(),
# random_black_forest(),
# fast_mcd(),
# phasespace_svm(),
# eif(),
# tanogan(),
stomp(),
# hotsax(),
# pci(),
# robust_pca(),
# dae(),
# ocean_wnn(),
# health_esn(),
# lstm_ad(),
# laser_dbn(),
# deepant(),
# bagel(),
# generic_xgb(),
# mtad_gat(),
# omnianomaly(),
# pst(),
# donut(),
# sr(),
# autoencoder(),
]
print(f"Selected algorithms: {len(algorithms)}")
sys.stdout.flush()
configurator.configure(algorithms, ignore_dependent=False, perform_search=False)
for algo in algorithms:
print(f"Algorithm {algo.name} param_grid:")
for config in algo.param_config:
print(f" {config}")
cluster_config = RemoteConfiguration(
scheduler_host=HPI_CLUSTER.odin01,
worker_hosts=HPI_CLUSTER.nodes
)
limits = ResourceConstraints(
tasks_per_host=15,
task_cpu_limit=1.,
train_timeout=Duration("1 minute"),
execute_timeout=Duration("1 minute")
)
timeeval = TimeEval(dm, datasets, algorithms,
repetitions=1,
# distributed=True,
# remote_config=cluster_config,
resource_constraints=limits,
skip_invalid_combinations=True,
metrics=[DefaultMetrics.ROC_AUC, DefaultMetrics.RANGE_PR_AUC]
)
timeeval.run()
print(timeeval.get_results(aggregated=False))
if __name__ == "__main__":
main()