fit

fit(model, data, frequency=None, solver=ScipyMinimizer(options={}), *, features=None, **kwargs)[source]

Fit a model to data using either optimization or sampling.

This is a unified router. The execution path is determined by the type of solver provided.

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

  • data (jnp.ndarray | skrf.Network | NetworkCollection) – The observed data (e.g., S-parameters).

  • 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, routes to frequentist minimization via pmrf.optimize.fit(). If a sampler, routes to Bayesian inference via pmrf.infer.condition().

  • features (EvaluatorLike | None, default=None) – The specific circuit feature to evaluate. If None, it defers to the native default of the chosen solver backend (‘s’ for optimization, (‘s_re’, ‘s_im’) for inference).

  • **kwargs (dict) – Additional arguments passed directly to the underlying fit function.

Returns:

A result object containing the newly fitted model. Depending on the solver, the model contains either optimized point-estimates or empirical posteriors.

Return type:

OptimizeResult | InferResult