-
Notifications
You must be signed in to change notification settings - Fork 0
/
traintest_zanin_time_series.py
130 lines (109 loc) · 5.74 KB
/
traintest_zanin_time_series.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
from generate_time_series import (load_logistic_map_time_series,
load_henon_map_time_series,
load_arnold_map_time_series,
load_arch_time_series,
load_garch_time_series)
from train_test_utils import train_test_distribution, train_test_distribution_montecarlo_ts
import numpy as np
import tqdm
def traintest_logistic_map():
log = load_logistic_map_time_series(length=3000, coef_a=4, x_initial=0.6)
filepath = "20230626_distributions/logistic.json"
train_test_distribution(log, num_runs=100,
window_len=5, hidden_size=20, num_epochs=30,
save_output_to_file=filepath)
print(filepath)
np.random.seed(42)
collection = [load_logistic_map_time_series(length=1500, x_initial=x) for x
in np.random.uniform(0, 1, size=100)]
filepath = "20230626_distributions/logistic_montecarlo.json"
train_test_distribution_montecarlo_ts(collection,
window_len=5, hidden_size=15,
datapoint_size=1, num_epochs=30,
save_output_to_file=filepath)
print(filepath)
def traintest_henon_map():
hen = load_henon_map_time_series(length=2000)
filepath = "20230626_distributions/henon.json"
train_test_distribution(hen, num_runs=100,
window_len=5, hidden_size=20, num_epochs=30,
save_output_to_file=filepath)
print(filepath)
np.random.seed(45)
collection = [load_henon_map_time_series(length=1500, x_initial=x, y_initial=y) for x, y
in np.random.uniform(0.1, 0.9, size=200).reshape(-1, 2)]
filepath = "20230626_distributions/henon_montecarlo.json"
train_test_distribution_montecarlo_ts(collection,
window_len=5, hidden_size=20,
datapoint_size=2, num_epochs=30,
save_output_to_file=filepath)
print(filepath)
def traintest_arnold_map():
arn = load_arnold_map_time_series(length=2000)
filepath = "20230626_distributions/arnold.json"
train_test_distribution(arn, num_runs=100,
window_len=5, hidden_size=20, num_epochs=30,
save_output_to_file=filepath)
print(filepath)
np.random.seed(45)
collection = [load_arnold_map_time_series(length=2000, x_initial=x, y_initial=y) for x, y
in np.random.uniform(0, 1, size=200).reshape(-1, 2)]
filepath = "20230626_distributions/arnold_montecarlo.json"
train_test_distribution_montecarlo_ts(collection,
window_len=5, hidden_size=20,
datapoint_size=2, num_epochs=30,
save_output_to_file=filepath)
print(filepath)
def traintest_arch():
np.random.seed(47)
grc = load_arch_time_series(length=3000)
filepath = "20230626_distributions/arch.json"
train_test_distribution(grc, num_runs=100,
window_len=5, hidden_size=20, num_epochs=10,
save_output_to_file=filepath)
print(filepath)
collection = [load_arch_time_series(length=3000, x_initial=x) for x
in np.random.uniform(0, 1, size=300).reshape(-1, 3)]
filepath = "20230626_distributions/arch_montecarlo.json"
train_test_distribution_montecarlo_ts(collection,
window_len=5, hidden_size=20,
datapoint_size=1, num_epochs=10,
save_output_to_file=filepath)
print(filepath)
def traintest_garch():
np.random.seed(48)
grc = load_garch_time_series(length=3000)
filepath = "20230626_distributions/garch_window_len=20.json"
train_test_distribution(grc, num_runs=10,
window_len=20, hidden_size=20, num_epochs=30,
save_output_to_file=filepath)
print(filepath)
def traintest_logistic_vs_length():
np.random.seed(154125)
for length in tqdm.tqdm((650, 850, 1150, 1500, 1850, 2250, 2750, 3250, 3500)):
filepath = f"20230626_distributions/logistic_vs_length/{length}.json"
collection = [load_logistic_map_time_series(length=length, x_initial=x) for x
in np.random.uniform(0.6, 0.8, size=30)]
train_test_distribution_montecarlo_ts(collection,
window_len=5, hidden_size=15,
datapoint_size=1, num_epochs=30,
save_output_to_file=filepath)
def traintest_henon_vs_length():
np.random.seed(154)
for length in tqdm.tqdm((500, 650, 850, 1000, 1150, 1300, 1500, 1620, 1850,
2000, 2250, 2500, 2750, 3000, 3250, 3500)):
filepath = f"20230626_distributions/henon_vs_length/{length}.json"
collection = [load_logistic_map_time_series(length=length, x_initial=x) for x
in np.random.uniform(0.6, 0.8, size=30)]
train_test_distribution_montecarlo_ts(collection,
window_len=5, hidden_size=15,
datapoint_size=1, num_epochs=30,
save_output_to_file=filepath)
if __name__ == "__main__":
# traintest_logistic_map()
# traintest_henon_map()
# traintest_arnold_map()
# traintest_arch()
# traintest_garch()
traintest_logistic_vs_length()
traintest_henon_vs_length()