fit

pmrf.fitting.fit(model: Model, data: Array | Network | NetworkCollection, frequency: Frequency | None = None, solver: AbstractMinimiser | Callable | AbstractSampler = ScipyMinimizer(options={}), *, features: str | list[str] | Callable[[Model, Frequency], Array] | list[Callable[[Model, Frequency], Array]] | None = 's', **kwargs) FitResult

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.

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

  • solver (Optimizer | Sampler, default=ScipyMinimizer()) – The solver to use. If an optimizer is passed, routes to frequentist minimization via pmrf.fitting.fit_minimize(). If a sampler, routes to Bayesian inference via pmrf.fitting.fit_sample(). Can be either in instance of pmrf.optimize.ScipyMinimizer, a minimizer from Optimistix (such as optimistix.LBFGS) or a sampler from Inferix (such as inferix.PolyChord).

  • 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