Hello!
Last monday, I updated all my packages.
Since then, my parameters estimation script does not seem to work fine anymore:
It gives Inf as Loss value whatever the algo (Optim, BlackBoxOptim, CMAES) or the data format (Matrix, Array , transposed or not).
After Investigating my script and dataset, I decided to run the basic example of DiffEqParamEstim:
using DifferentialEquations, DiffEqParamEstim
function f(du,u,p,t)
du[1] = dx = p[1]*u[1] - u[1]*u[2]
du[2] = dy = -3*u[2] + u[1]*u[2]
end
u0 = [1.0;1.0]
tspan = (0.0,10.0)
p = [1.5]
prob = ODEProblem(f,u0,tspan,p)
sol = solve(prob,Tsit5())
t = collect(range(0,stop=10,length=200))
using RecursiveArrayTools # for VectorOfArray
randomized = VectorOfArray([(sol(t[i]) + .01randn(2)) for i in 1:length(t)])
data = convert(Array,randomized)
cost_function = build_loss_objective(prob,Tsit5(),L2Loss(t,data),
maxiters=10000,verbose=false)
using Optim
result = optimize(cost_function, 0.0, 10.0)
output of result = optimize(cost_function, 0.0, 10.0)
:
Results of Optimization Algorithm
Did anyone have the same isssue and had identified the problem?
Julia version: 1.8.2
Packages versions:
[a134a8b2] BlackBoxOptim v0.6.2
[8d3b24bd] CMAEvolutionStrategy v0.2.5
[336ed68f] CSV v0.10.7
[479239e8] Catalyst v12.3.1
[861a8166] Combinatorics v1.0.2
[a93c6f00] DataFrames v1.4.2
[bcd4f6db] DelayDiffEq v5.38.3
[1130ab10] DiffEqParamEstim v1.27.0
[0c46a032] DifferentialEquations v7.6.0
[31c24e10] Distributions v0.25.76
[89b67f3b] ExcelFiles v1.0.0
[38e38edf] GLM v1.8.1
[28b8d3ca] GR v0.69.5
[09f84164] HypothesisTests v0.10.11
[7073ff75] IJulia v1.23.3
[615f187c] IfElse v0.1.1
[a98d9a8b] Interpolations v0.14.6
[c8e1da08] IterTools v1.4.0
[ccbc3e58] JumpProcesses v9.2.2
[b964fa9f] LaTeXStrings v1.3.0
[23fbe1c1] Latexify v0.15.17
[93acb638] LikelihoodProfiler v0.5.0
[7ed4a6bd] LinearSolve v1.27.1
[442fdcdd] Measures v0.3.1
[961ee093] ModelingToolkit v8.30.0
[429524aa] Optim v1.7.3
[1dea7af3] OrdinaryDiffEq v6.30.1
[58dd65bb] Plotly v0.4.1
[a03496cd] PlotlyBase v0.8.19
[f0f68f2c] PlotlyJS v0.18.10
[f2990250] PlotlyKaleido v1.0.0
[91a5bcdd] Plots v1.35.7
[d330b81b] PyPlot v2.11.0
[1fd47b50] QuadGK v2.6.0
[731186ca] RecursiveArrayTools v2.32.1
[0bca4576] SciMLBase v1.67.0
[2913bbd2] StatsBase v0.33.21
[78aadeae] SymbolicNumericIntegration v0.8.6
[d1185830] SymbolicUtils v0.19.11
[0c5d862f] Symbolics v4.13.0
[770da0de] UpdateJulia v0.4.0
[37e2e46d] LinearAlgebra
[9e88b42a] Serialization
cc @Christopher Rackauckas
Yes, if you update it should be fixed by https://github.com/SciML/DiffEqParamEstim.jl/pull/184
This month we've been ripping off some final bandaids, removing last piracies of old and changing symbols to enums. There's a few spots that got hit by bad practices, and we're doing a bit of clean up. We should be in a really good spot in the coming month.
Can confirm:
julia> begin
using DifferentialEquations, DiffEqParamEstim
function f(du,u,p,t)
du[1] = dx = p[1]*u[1] - u[1]*u[2]
du[2] = dy = -3*u[2] + u[1]*u[2]
end
u0 = [1.0;1.0]
tspan = (0.0,10.0)
p = [1.5]
prob = ODEProblem(f,u0,tspan,p)
sol = solve(prob,Tsit5())
t = collect(range(0,stop=10,length=200))
using RecursiveArrayTools # for VectorOfArray
randomized = VectorOfArray([(sol(t[i]) + .01randn(2)) for i in 1:length(t)])
data = convert(Array,randomized)
cost_function = build_loss_objective(prob,Tsit5(),L2Loss(t,data),
maxiters=10000,verbose=false)
using Optim
result = optimize(cost_function, 0.0, 10.0)
end
Results of Optimization Algorithm
* Algorithm: Brent's Method
* Search Interval: [0.000000, 10.000000]
* Minimizer: 1.499964e+00
* Minimum: 3.803244e-02
* Iterations: 27
* Convergence: max(|x - x_upper|, |x - x_lower|) <= 2*(1.5e-08*|x|+2.2e-16): true
* Objective Function Calls: 28
(jl_IV4Jkh) pkg> st
Status `/tmp/jl_IV4Jkh/Project.toml`
[1130ab10] DiffEqParamEstim v1.28.0
[0c46a032] DifferentialEquations v7.6.0
[429524aa] Optim v1.7.3
[731186ca] RecursiveArrayTools v2.32.1
Danilo D. has marked this topic as resolved.
Last updated: Nov 22 2024 at 04:41 UTC