Skip to content

Commit f358511

Browse files
noise reduction
1 parent 6571149 commit f358511

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

DelayLotkaVolterra/VolterraExp.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ plot!(solution, alpha = 0.5)
3232
# Ideal data
3333
tsdata = Array(solution)
3434
# Add noise to the data
35-
noisy_data = tsdata + Float32(1e-4)*randn(eltype(tsdata), size(tsdata))
35+
noisy_data = tsdata + Float32(1e-5)*randn(eltype(tsdata), size(tsdata))
3636

3737
plot(abs.(tsdata-noisy_data)')
3838

@@ -133,7 +133,7 @@ basis = Basis(h, u)
133133
# Create an optimizer for the SINDY problem
134134
opt = SR3()
135135
# Create the thresholds which should be used in the search process
136-
λ = exp10.(-10:0.1:3)
136+
λ = exp10.(-6:0.1:2)
137137
# Target function to choose the results from; x = L0 of coefficients and L2-Error of the model
138138
f_target(x, w) = iszero(x[1]) ? Inf : norm(w.*x, 2)
139139

@@ -143,12 +143,12 @@ println(Ψ)
143143
print_equations(Ψ)
144144

145145
# Test on ideal derivative data ( not available )
146-
Ψ = SInDy(X[:, 5:end], L[:, 5:end], basis, λ, opt = opt, maxiter = 10000, f_target = f_target) # Suceed
146+
Ψ = SInDy(X[:, 5:end], L[:, 5:end], basis, λ, opt = opt, maxiter = 10000, f_target = f_target) # Succeed
147147
println(Ψ)
148148
print_equations(Ψ)
149149

150150
# Test on uode derivative data
151-
Ψ = SInDy(noisy_data[:, 2:end], L̂[:, 2:end], basis, λ, opt = opt, maxiter = 100000, normalize = true, denoise = true, f_target = f_target) # Suceed
151+
Ψ = SInDy(X[:, 2:end], L̂[:, 2:end], basis, λ, opt = opt, maxiter = 10000, normalize = true, denoise = true, f_target = f_target) # Succeed
152152
println(Ψ)
153153
print_equations(Ψ)
154154
= parameters(Ψ)
@@ -161,7 +161,7 @@ unknown_eq = ODEFunction(unknown_sys)
161161
# Just the equations
162162
b = Basis((u, p, t)->unknown_eq(u, [1.; 1.], t), u)
163163
# Retune for better parameters -> we could also use DiffEqFlux or other parameter estimation tools here.
164-
Ψf = SInDy(noisy_data[:, 2:end], L̂[:, 2:end], b, opt = SR3(0.01), maxiter = 100, convergence_error = 1e-18) # Suceed
164+
Ψf = SInDy(noisy_data[:, 2:end], L̂[:, 2:end], b, opt = SR3(0.01), maxiter = 100, convergence_error = 1e-18) # Succeed
165165
println(Ψf)
166166
= parameters(Ψf)
167167

0 commit comments

Comments
 (0)