I am trying get a neural ODE working, that doesn’t have a function/ode as input but a measurement.
I want to apply the neural ODE to get the original function expressed by the measurement and not the derivative.
I am trying to use this three websites:
https://docs.sciml.ai/DiffEqFlux/stable/examples/neural_ode/
https://sebastiancallh.github.io/post/neural-ode-weather-forecast/
But the sites use different librarys Lux and Flux also do not contain a simple example of how input the measurement.
For measurement I again use:
heating Q in percent 0 to 100 in X
and resulting temperature in Kelvin. The starting temperature is: 296.693 K.
This the code I came up with so far
u0 = Float64[296.693, ]
tspan = (0.0, 8_000)
tsteps = range(tspan[1], tspan[2], length=30)
dudt = Flux.Chain(Flux.Dense(1=>32, tanh),
Flux.Dense(32=>1)) |> f64
u = static_df.Q1
y = static_df.T1
n_ode = NeuralODE(dudt, tspan, Tsit5(), saveat=tsteps, reltol=1e-7,abstol=1e-9)
ps = Flux.params(n_ode)
function predict_n_ode(u)
n_ode(u)
end
loss_n_ode() = sum(abs2,y .- predict_n_ode(u))
opt_n_ode = ADAM(0.1)
Flux.train!(loss_n_ode, ps, (u, y), opt_n_ode)
I get the error: no method matching loss_n_ode(::Vector{Float64})
. Which makes perfectly sense, I just don’t know. How I should have done it instead.