Model vs CompositeModel class #863
-
What are the advantages and disadvantages of creating my own model or creating a composite model? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Using a CompositeModel instead of hand-coded Model is really a matter of convenience. Asteval is used only if you use an ExpressionModel (which should be viewed as a "cute trick", and maybe useable, but not really recommended) and for implementing constraints. The resulting route through Python code will be different for a Model function that implements the same functionality as a CompositeModel, but the mathematics of the solution (basically down to the number of function evaluations and steps in the parameter values) should be identical. Just to be clear, the entire rationale for |
Beta Was this translation helpful? Give feedback.
Using a CompositeModel instead of hand-coded Model is really a matter of convenience. Asteval is used only if you use an ExpressionModel (which should be viewed as a "cute trick", and maybe useable, but not really recommended) and for implementing constraints.
The resulting route through Python code will be different for a Model function that implements the same functionality as a CompositeModel, but the mathematics of the solution (basically down to the number of function evaluations and steps in the parameter values) should be identical.
Just to be clear, the entire rationale for
lmfit
existing at all, and the entire rationale forscipy
existing at all can be described as "convenience".…