calamari.fitting.models.ModelDefinition#

class calamari.fitting.models.ModelDefinition(name, function, param_names, param_defaults, description, guess=None)#

Bases: object

Descriptor for a built-in (or user-registered) fit function.

A model is a pure callable plus the metadata the fit engine needs to drive it: what its parameters are called, where to start them, and how to describe it to a human. Kept frozen so a registered definition cannot be mutated out from under the registry.

name#

Registry key, e.g. 'curie_weiss'. Must be unique within MODELS (see register_model()).

Type:

str

function#

The model itself, f(x, *params) -> numpy.ndarray, with params in the order given by param_names.

Type:

Callable

param_names#

Ordered parameter names. The order is load-bearing: it is the order in which values are passed to function and reported by the fit.

Type:

tuple of str

param_defaults#

Generic starting values, one per parameter. These are fallback seeds: calamari.fitting.engine.fit() overlays a data-driven guess (if any) and then the caller’s explicit initial on top of them, so a default only survives when nothing better is supplied.

Type:

dict of str to float

description#

Human-readable description including a literature/provenance note.

Type:

str

guess#

guess(x, y) -> dict returning data-driven starting values for some or all parameters. Used by the engine to refine param_defaults before fitting. None (the default) means no data-driven seed.

Type:

Callable or None, optional