-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_scalability.py
99 lines (75 loc) · 2.3 KB
/
test_scalability.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
from leitmotifs.plotting import *
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
import warnings
warnings.simplefilter("ignore")
import matplotlib as mpl
mpl.rcParams['figure.dpi'] = 150
path = "../datasets/experiments/"
def read_penguin_data():
series = pd.read_csv(path + "penguin.txt",
names=(["X-Acc", "Y-Acc", "Z-Acc",
"4", "5", "6",
"7", "Pressure", "9"]),
delimiter="\t", header=None)
ds_name = "Penguins (Longer Snippet)"
return ds_name, series
def test_penguins_univ():
lengths = [#1_000, 5_000,
#10_000, 30_000,
50_000 # , 100_000,
# 150_000, 200_000,
# 250_000
]
ds_name, B = read_penguin_data()
time_s = np.zeros(len(lengths))
for i, length in enumerate(lengths):
print("Current", length)
series = B.iloc[:length,0].T
ml = LAMA(ds_name,
series,
n_jobs=8,
)
k_max = 5
t_before = time.time()
_ = ml.fit_k_elbow(
k_max,
22,
plot_elbows=False,
)
t_after = time.time()
time_s[i] = t_after - t_before
print("Time:", time_s[i])
def test_penguins_multivariate():
lengths = [1_000,
5_000,
10_000,
30_000,
#50_000,
# 100_000,
# 150_000, 200_000,
# 250_000
]
ds_name, B = read_penguin_data()
time_s = np.zeros(len(lengths))
for i, length in enumerate(lengths):
print("Current", length, flush=True)
series = B.iloc[:length].T
ml = LAMA(ds_name,
series,
n_dims=3,
# backend="scalable",
)
k_max = 5
t_before = time.time()
_ = ml.fit_k_elbow(
k_max,
motif_length=22,
plot_elbows=False,
plot_motifsets=False
)
t_after = time.time()
time_s[i] = t_after - t_before
memory_usage = ml.memory_usage
print("\tTime:", time_s[i])
print("\tMemory:", memory_usage, "MB")