pmrf.fitting.FrequentistFitter

class pmrf.fitting.FrequentistFitter(model, *, cost_kind=None, cost_function=None, **kwargs)[source]

Bases: BaseFitter

A base class for frequentist (classical) optimization methods.

This class extends BaseFitter by adding the concept of a cost function, which takes the difference between model features and measured features and computes a single scalar value representing the “cost” or “error”.

Parameters:
  • model (Model)

  • cost_kind (str | None)

  • cost_function (Callable[[Array], Array] | list[Callable[[Array], Array]] | Module | None)

__init__(model, *, cost_kind=None, cost_function=None, **kwargs)[source]

Initializes the FrequentistFitter.

Parameters:
  • model (Model) – The parametric pmrf Model to be fitted.

  • cost_kind (str, optional) – A cost ‘kind’ alias to initialize the features and cost function from. Can be one of ‘convolutional’, ‘complex’, ‘magnitude’ or None.

  • cost_function (ArrayFuncT, list[ArrayFuncT] or eqx.Module, optional) – A function or sequence of functions defining the cost metric. If a list of functions is provided, they are composed sequentially. If None, then cost_kind defines the cost function. Defaults to None.

  • **kwargs – Additional arguments forwarded to BaseFitter.

Return type:

None

Methods

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(model, *[, cost_kind, cost_function])

Initializes the FrequentistFitter.

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(**kwargs)

__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

_create_context(measured, *[, cost_kind, ...])

Create a FrequentistContext for the fitting process.

_run_algorithm(context, **kwargs)

Executes the fitting algorithm.

_run_context(context, *[, load_previous, ...])

Executes the fitting context.

fit(measured, **kwargs)

Fits the model to measured data.

fit_submodels(measured, **kwargs)

Fits the submodels.

Attributes

__abstractmethods__

__annotations__

__dict__

__doc__

__module__

__slots__

__weakref__

list of weak references to the object (if defined)

_abc_impl

__init__(model, *, cost_kind=None, cost_function=None, **kwargs)[source]

Initializes the FrequentistFitter.

Parameters:
  • model (Model) – The parametric pmrf Model to be fitted.

  • cost_kind (str, optional) – A cost ‘kind’ alias to initialize the features and cost function from. Can be one of ‘convolutional’, ‘complex’, ‘magnitude’ or None.

  • cost_function (ArrayFuncT, list[ArrayFuncT] or eqx.Module, optional) – A function or sequence of functions defining the cost metric. If a list of functions is provided, they are composed sequentially. If None, then cost_kind defines the cost function. Defaults to None.

  • **kwargs – Additional arguments forwarded to BaseFitter.

Return type:

None