fit

pmrf.fitting.fit(model: ModelT, data: Array | Network | NetworkCollection, solver: AbstractUnconstrainedMinimizer | AbstractBoundedMinimizer | AbstractJointSampler | AbstractSplitSampler | AbstractHypercubeSampler = ScipyMinimize(options={}), frequency: Frequency | None = None, *, features: str | list[str] | Callable[[Model, Frequency], Array] | list[Callable[[Model, Frequency], Array]] | None = 's', **kwargs) FitResult[ModelT]

Fit a model to data using a variety of methods.

This is a unified router to either pmrf.fitting.fit_minimize() or pmrf.fitting.fit_sample(). The execution path is determined by the type of solver provided. All key-word arguments are forward appropriately.

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

  • data (jnp.ndarray | skrf.Network | NetworkCollection) – The data to fit. Can either be a JAX array, a skrf.Network, or a pmrf.NetworkCollection.

  • solver (AbstractFitter, default=ScipyMinimize()) – The solver to use. If an optimizer is passed, routes to frequentist minimization via pmrf.fitting.fit_minimize(). If a sampler is passed, routes to Bayesian inference via pmrf.fitting.fit_sample(). See pmrf.optimize and pmrf.sample for available solvers.

  • frequency (Frequency | None, default=None) – The frequency sweep. Required if data is a raw array.

  • features (EvaluatorLike | None, default='s') – The RF features to fit. Defaults to all S-parameters. Can either be an instance of pmrf.Evaluator or a string, in which case a ‘feature’ evaluator is created (see pmrf.evaluators.Feature).

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

Returns:

A result object containing the fitted model and backend solution results. Frequentist optimizers return a single best model, whereas Bayesian inferers also return full posterior distributions on the model.

Return type:

FitResult