ADR Suggestion
Fitting Using Third-Party Minimizers – Design Review & Clarifications
#109
Replies: 2 comments
-
Related resources and minimization engines we use: scipy.optimize: nonlinear least-squares and curve fitting Lmfit: non-linear optimization and curve fitting Bumps: curve fitting and uncertainty analysis from a Bayesian perspective DFO-LS: derivative-free optimizer for least-squares minimization |
Beta Was this translation helpful? Give feedback.
-
The
|
Beta Was this translation helpful? Give feedback.
-
We currently have an ADR titled "Fitting using third-party minimizers" (#9).
This ADR was created before we established the formal "Protocol for Creating ADRs", so it doesn't have an associated discussion thread suggesting it as a new ADR.
Since a few new questions and concerns have surfaced regarding the current design, I am creating this ADR suggestion to discuss and clarify them. Once we have consensus, we can update the original ADR, if necessary.
Proposed API Improvements
The existing ADR states:
However, it doesn’t explain why the current implementation uses a function rather than a class.
Additionally, it doesn’t provide reasoning for why
AvailableMinimizers
is implemented as a separate class.So, we have:
easyscience/fitting/minimizers/factory.py
easyscience/fitting/available_minimizers.py
This structure feels unnecessarily complex and potentially confusing.
Below is a simplified class diagram illustrating the current setup:
Proposal
I suggest we discuss whether this design can be improved by consolidating the functionality into a single
MinimizerFactory
class, which would:This could simplify both the internal design and the user-facing API.
User API (No Change Proposed)
Regardless of whether we keep the existing design or adopt a new, unified design, users should not need to access the factory directly.
We have already agreed that the
Analysis
object is responsible for minimization, so the API for users should remain simple and intuitive:Naming Convention Clarification
There is currently a mix of fit-based and minimize-based names in the codebase and documentation.
This inconsistency can lead to confusion.
We should clarify when and where to use:
fit
,Fitter
,available_fitters
, etc.versus
minimize
,Minimizer
,available_minimizers
, etc.I propose we document the chosen convention explicitly as part of this ADR.
Beta Was this translation helpful? Give feedback.
All reactions