I am going over some demos in SciML. Consider the code fragment found at
https://docs.sciml.ai/Overview/stable/showcase/missing_physics/#autocomplete
function predict(θ, X = Xₙ[:, 1], T = t)
_prob = remake(prob_nn, u0 = X, tspan = (T[1], T[end]), p = θ)
Array(solve(_prob, Vern7(), saveat = T,
abstol = 1e-6, reltol = 1e-6))
end
function loss(θ)
X̂ = predict(θ)
mean(abs2, Xₙ .- X̂)
end
I do not understand the call to predict(θ)
in the loss
function. For default arguments to work properly, shouldn’t the second and third arguments of predict
follow a semi-colon? In other words, shouldn’t the function have the prototype:
function predict(θ; X = Xₙ[:, 1], T = t)
Thanks.