-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathroessler_statistics_MSE.jl
73 lines (65 loc) · 2.66 KB
/
roessler_statistics_MSE.jl
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
using GeneralizedDynamicsFromData
using OrderedCollections
using JLD2
using FileIO
experiment_name = "roessler_statistics_MSE"
repetitions = 100
weight_decay = 1e-4
η = 1e-1
η_decay_rate = 0.5
η_decay_step = 100
η_limit = 1e-4
construct_optimiser() = Flux.Optimiser(WeightDecay(weight_decay),
ExpDecay(η,η_decay_rate,η_decay_step,η_limit),
ADAM())
construct_loss(θ, y, predict) = mse_loss(θ, y, predict)
net_config = OrderedDict([
:inputs => 3,
:outputs => 1,
:neurons => 16,
:layers => 1,
:non_lin => tanh,
:initialization => Flux.glorot_normal
])
problem_period1 = Dict([:equation => roessler,
:parameters => Float64[0.1, 0.1, 4.0],
:u0 => Float64[1.0, 1.0, 1.0],
:tspan => (0.0f0, 10.0f0),
:ts => 0.1,
:solver => Tsit5,
:optimizer => construct_optimiser,
:max_iter => 1500,
:loss => construct_loss]
)
for noise in [5e-3, 1e-3, 1e-4, 1e-5]
summary, callbacks = repeat_experiment(problem_period1,
net_config,
repetitions;
ε = noise,
progress=false)
filename_cb = joinpath("./data/", experiment_name*"_p1_"*string(noise)*"_all.h5")
filename_sum = joinpath("./data/", experiment_name*"_p1_"*string(noise)*".jld2")
callbacks_to_hdf5(callbacks, filename_cb)
save(filename_sum, summary)
end
problem_period2 = Dict([:equation => roessler,
:parameters => Float64[0.1, 0.1, 6.0],
:u0 => Float64[1.0, 1.0, 1.0],
:tspan => (0.0f0, 10.0f0),
:ts => 0.1,
:solver => Tsit5,
:optimizer => construct_optimiser,
:max_iter => 1500,
:loss => construct_loss]
)
for noise in [5e-3, 1e-3, 1e-4, 1e-5]
summary, callbacks = repeat_experiment(problem_period2,
net_config,
repetitions;
ε = noise,
progress=false)
filename_cb = joinpath("./data/", experiment_name*"_p2_"*string(noise)*"_all.h5")
filename_sum = joinpath("./data/", experiment_name*"_p2_"*string(noise)*".jld2")
callbacks_to_hdf5(callbacks, filename_cb)
save(filename_sum, summary)
end