pmrf.fitting.BayesianFitter
- class pmrf.fitting.BayesianFitter(model, *, likelihood_kind=None, likelihood_params=None, feature_sigmas=None, **kwargs)[source]
Bases:
BaseFitterA base class for Bayesian fitting methods.
This class extends BaseFitter by adding the concept of a likelihood function.
- Parameters:
- __init__(model, *, likelihood_kind=None, likelihood_params=None, feature_sigmas=None, **kwargs)[source]
Initializes the BayesianFitter.
- Parameters:
model (Model) – The parametric pmrf model to be fitted.
likelihood_kind (str, optional) – The kind of likelihood to use. Can be either ‘gaussian’ or ‘multivariate_gaussian’. Defaults internally to ‘gaussian’ for one-port fits, and ‘multivariate_gaussian’ for greater port fits. For ‘gaussian’, a single likelihood parameter, ‘sigma’, is needed. For ‘multivariate_gaussian’, either multiple standard deviations ‘sigma_0’, ‘sigma_1’, …, ‘sigma_N’ may be passed, where N is the number of features, or an arbitrary number of arbitrarily named likelihood parameters may be passed, along with a list of strings feature_sigmas of size N containing the names of the likelihood parameters to use for each feature.
likelihood_params (dict[str, Parameter], optional) – A dictionary of likelihood parameters to use for the likelihood function.
feature_sigmas (list[str], optional) – A list of sigma names for each feature. Only used when likelihood_kind is ‘multivariate_gaussian’.
**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, *[, likelihood_kind, ...])Initializes the BayesianFitter.
__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, *[, ...])Create a BayesianContext for the fitting process.
_run_algorithm(context, **kwargs)Executes the fitting algorithm.
_run_context(ctx[, plot_params, ...])Execute the Bayesian fitting process within a 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, *, likelihood_kind=None, likelihood_params=None, feature_sigmas=None, **kwargs)[source]
Initializes the BayesianFitter.
- Parameters:
model (Model) – The parametric pmrf model to be fitted.
likelihood_kind (str, optional) – The kind of likelihood to use. Can be either ‘gaussian’ or ‘multivariate_gaussian’. Defaults internally to ‘gaussian’ for one-port fits, and ‘multivariate_gaussian’ for greater port fits. For ‘gaussian’, a single likelihood parameter, ‘sigma’, is needed. For ‘multivariate_gaussian’, either multiple standard deviations ‘sigma_0’, ‘sigma_1’, …, ‘sigma_N’ may be passed, where N is the number of features, or an arbitrary number of arbitrarily named likelihood parameters may be passed, along with a list of strings feature_sigmas of size N containing the names of the likelihood parameters to use for each feature.
likelihood_params (dict[str, Parameter], optional) – A dictionary of likelihood parameters to use for the likelihood function.
feature_sigmas (list[str], optional) – A list of sigma names for each feature. Only used when likelihood_kind is ‘multivariate_gaussian’.
**kwargs – Additional arguments forwarded to
BaseFitter.
- Return type:
None