pmrf.fitting.fitters.PolychordFitter

class pmrf.fitting.fitters.PolychordFitter(model, measured, frequency=None, features=None, likelihood_kind='gaussian', likelihood_params=None, *args, **kwargs)[source]

Bases: BayesianFitter

Polychord fitter using pypolychord.run.

Polychord has its own license available at https://github.com/PolyChord/PolyChordLite.

Initializes the BayesianFitter.

Args:
model (Model):

The parametric pmrf model to be fitted.

measured (skrf.Network | list[skrf.Network]):

The measured network data to fit the model against.

frequency (skrf.Frequency | None, optional):

The frequency axis to perform the fit on. Defaults to None.

features (FeatureT | FeatureListT | None = None, optional):

The features to extract for comparison. Note that note all features make sense for all likelihoods, but no error checking is done for this. Defaults to None, in which case real and imaginary feature for all model ports are used.

likelihood_kind (str, optional):

The kind of likelihood to use. Defaults to “gaussian” for a one-dimensional Gaussian likelihood requiring a single likelihood parameter ‘sigma’. Can also be “multivariate_gaussian”, in which case 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.

Parameters:
  • model (Model)

  • measured (Network | dict[str, Network])

  • frequency (Frequency | None)

  • features (str | tuple[str, str] | tuple[str, str, tuple[int, int]] | Sequence[str | tuple[str, str] | tuple[str, str, tuple[int, int]]] | dict[str, str | tuple[str, str] | tuple[str, str, tuple[int, int]] | Sequence[str | tuple[str, str] | tuple[str, str, tuple[int, int]]]] | None)

  • likelihood_kind (str | None)

  • likelihood_params (dict[str, Parameter])

__init__(model, measured, frequency=None, features=None, likelihood_kind='gaussian', likelihood_params=None, *args, **kwargs)

Initializes the BayesianFitter.

Args:
model (Model):

The parametric pmrf model to be fitted.

measured (skrf.Network | list[skrf.Network]):

The measured network data to fit the model against.

frequency (skrf.Frequency | None, optional):

The frequency axis to perform the fit on. Defaults to None.

features (FeatureT | FeatureListT | None = None, optional):

The features to extract for comparison. Note that note all features make sense for all likelihoods, but no error checking is done for this. Defaults to None, in which case real and imaginary feature for all model ports are used.

likelihood_kind (str, optional):

The kind of likelihood to use. Defaults to “gaussian” for a one-dimensional Gaussian likelihood requiring a single likelihood parameter ‘sigma’. Can also be “multivariate_gaussian”, in which case 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.

Parameters:
  • model (Model)

  • measured (Network | dict[str, Network])

  • frequency (Frequency | None)

  • features (str | tuple[str, str] | tuple[str, str, tuple[int, int]] | Sequence[str | tuple[str, str] | tuple[str, str, tuple[int, int]]] | dict[str, str | tuple[str, str] | tuple[str, str, tuple[int, int]] | Sequence[str | tuple[str, str] | tuple[str, str, tuple[int, int]]]] | None)

  • likelihood_kind (str | None)

  • likelihood_params (dict[str, Parameter])

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).

__getstate__()

Helper for pickle.

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(model, measured[, frequency, ...])

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__(*args, **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().

_flat_param_names()

_make_feature_function([as_numpy])

_make_gaussian_log_likelihood_fn()

_make_log_likelihood_fn([as_numpy])

_make_log_prior_fn([as_numpy])

_make_multivariate_gaussian_log_likelihood_fn()

_make_prior_transform_fn([as_numpy])

_settings([solver_kwargs, fitter_kwargs])

run([best_param_method, nlive_factor])

Executes the fitting algorithm.

Attributes

__abstractmethods__

__annotations__

__dict__

__doc__

__module__

__slots__

__weakref__

list of weak references to the object

_abc_impl

num_likelihood_params

num_model_params

num_params

run(best_param_method='maximum-likelihood', nlive_factor=None, **kwargs)[source]

Executes the fitting algorithm.

This method must be implemented by all concrete subclasses. It is the main entry point to start the optimization or sampling process.

Returns:

FitResults: An object containing the results of the fit.

Return type:

AnestheticResults