# [DiffEqParamEstim.jl] Add a findfit function

Hy !
I had written a Git issue a few months ago ( Add a findfit function · Issue #220 · SciML/DiffEqParamEstim.jl (github.com)) on this subject but having had no response I take the liberty of making a post here.

Since the package DiffEqParamEstim.jl is defined as "a simple interface for users who want to quickly run standard parameter estimation routines for model calibration ", it would be interesting to add a `findfit` function on the model of the homonymous functions in Wolfram Mathematica (FindFit: Find parameters to best fit data—Wolfram Documentation ; Fitting system of Differential equations to a dataset - Online Technical Discussion Groups—Wolfram Community) or SageMath (Numerical Root Finding and Optimization - Numerical Optimization) for example. This `findfit` function would combine a “generic” cost function, the definition of the `OptimizationProblem` and the solving. It would greatly simplify the use of DiffEqParamEstim.jl, which is certainly very efficient for complex situations, but which is a bit of a gas factory when you only have a small ODE system to fit on data.

I’m also convinced that the `varmap_to_vars` function, which is essential for combining ModelingToolkit and DiffEqParamEstim.jl, is extremely unintuitive and could be greatly improved. The documentation (Frequently Asked Questions · ModelingToolkit.jl) alone is confusing. Just one example : unless I’m mistaken, the expression

``````pnew = varmap_to_vars([β => 3.0, c => 10.0, γ => 2.0], parameters(sys))
su
``````

suggests that `pnew` is a new ordered version of `p`, when in fact it’s a list of indices (to which `Int.` must be applied to make them integer). Further down the page, the explanations “Using ModelingToolkit with Optimization / Automatic Differentiation” are also quite confusing, in my opinion.

fdekerm

Sorry, I generally respond to every SciML issue but I don’t have this email in my inbox so I must’ve accidentally deleted it or something. Thanks for getting back in touch.

Yes, that would be a nice contribution. I don’t plan to work on this but would accept a PR.

People shouldn’t be using this so much anymore. `remake`, `prob[p]`, and `sol[p]` should be sufficient for what most people need to be doing.

1 Like