condition

condition(model, data, frequency=None, solver=PolyChord(nlives={}), *, features='s', likelihood_fn=None, **kwargs)[source]

Conditions an RF model on measured data using Bayesian inference.

This high-level function handles data format coercion (e.g., extracting arrays from scikit-rf Networks) and automatically composes the necessary evaluator metrics to compute the log-likelihood over the parameter space.

Parameters:
  • model (Model) – The RF model to fit.

  • data (jnp.ndarray | skrf.Network | NetworkCollection) – The target data to fit against. Can be raw JAX arrays or standard Touchstone networks.

  • frequency (Frequency | None, default=None) – The frequency sweep. Required if data is a raw array; otherwise automatically extracted from the Network object.

  • solver (Solver, default=PolyChord()) – The Bayesian sampling algorithm backend (e.g., PolyChord, MultiNest).

  • features (EvaluatorLike, default='s') – The specific circuit feature(s) to compute the likelihood against. Usually passed as a tuple of real and imaginary parts for Bayesian analysis.

  • likelihood_fn (Callable[[jnp.ndarray], dist.AbstractDistribution], optional) – The likelihood function that accepts a model prediction and returns a distribution representing the probability of observing data given that prediction. Can be a function or a callable PyTree. See :mod:pmrf.likelihoods for common likelihoods. Defaults to None, in which case :class:pmrf.likelihoods.ComplexGaussianLikelihood is constructed internally with a symmetric noise model.

  • **kwargs (dict) – Additional keyword arguments passed to the underlying solver.

Returns:

The result containing the model loaded with empirical posterior distributions.

Return type:

InferenceResult