Skip to content
Brian Benjamin Maranville edited this page Sep 4, 2024 · 2 revisions

There are a number of fitting engines included in bumps.fitters. Each of these is initialized with different arguments to control how they operate, but once started they share a similar theory of operation:

---
title: Bumps Fitting loop
---

flowchart LR
    A([Start]) --> B{"`Stopping
                     condition?`"}
    B -->|No| C[Choose new parameters]
    C --> D["FitProblem.setp(pars)"]
    D --> E["`FitProblem.nllf()`"]
    E --> B
    B ---->|Yes| F([End])
Loading

The Stopping condition indicated above is one of these:

  • fit is converged, as defined by the settings of that particular fitter
  • maximum number of iterations of fit loop has been reached
  • fit abort signal set

At each iteration of the fit inner loop, the fit engine evaluates a set of parameters by

  • calling FitProblem.setp(pars: List[float]), with the new parameters in pars, which
    • sets all the fittable parameters in the problem to the new values
    • calls the update() method on all models (signal to clear caches and recalculate state)
  • calling FitProblem.nllf(), which sums:
    • FitProblem.parameter_nllf() which returns a large value if any parameter is out of bounds
    • FitProblem.model_nllf(), which calls model.nllf() for every model in the problem
    • FitProblem.constraints_nllf() which returns a large value if any constraint is violated
Clone this wiki locally