I copied the example here:
And put in my own function. Everything else is the same except for I didn’t add noise.
U = Lux.Chain( Lux.Dense(5,3,rbf), Lux.Dense(3,3, rbf), Lux.Dense(3,3, rbf), Lux.Dense(3,5) ) # Get the initial parameters and state variables of the model p, st = Lux.setup(rng, U) function ude_dynamics!(du, u, p, t, p_true) û = U(u, p, st) # Network prediction p1, p2, p3, p4, p5, p6, p7, p8, p9 = p a, b, c, d, e = u da = û db = c - p8 - (p3 + p4*p9 + (-p5*e) / a)*p9*a dc = p6*((p3 + p4*p9 + (-p5*e) / a)*p9*a + d + p8) - c dd = p7*(p2*a + p1*e) - d de = (p3 + p4*p9 + (-p5*e) / a)*p9*a + d + p8 - c - e du = da; du = db; du = dc; du = dd; du = de end #Initial system: da = (p3 + p4*p9 + (-p5*e) / a)*p9*a + p8 - c tspan = (0.0,90.0) u0 = Float32[86.5,21.62,21.62,86.5,86.5] p_ = Float32[0.6,0.4,0.635,5,0.01,0.2,0.3,20,0.025]
However, it’s giving me a linear approximation for da, though BFGS finishes way before max iterations.
Does anyone know what might be going wrong? I have tried up to 10 in the layers but don’t want to try more unless that’s the actual cause as when I tried 19 it takes a really long time and then aborts as unstable. I have tried with multiple solvers with the above:
Vern7 and KenCarp4 works but gives a linear approximation for da
Tsit5 aborts as unstable when BFGS runs (this solved the original ODE)
Tried a few others, Rosenbrock23 and Rodas4 but these don’t run at all…