fit_minimize
- pmrf.fitting.fit_minimize(model: Model, data: Array | Network | NetworkCollection, frequency: Frequency | None = None, solver: AbstractMinimiser | Callable = ScipyMinimizer(options={}), *, features: str | list[str] | Callable = 's', loss_fn: Callable = RMSELoss(multioutput='uniform_average', name=None), multioutput: Literal['raw_values', 'uniform_average', 'geometric_mean', 'convolution'] | None = None, scale_fn: str | Callable | None = None, **kwargs) FitResult
Fits an RF model to measured data using non-linear optimization.
This high-level function handles data formatting (e.g., extracting arrays from the scikit-rf Networks) and forwards to
pmrf.optimize.minimize().- Parameters:
model (Model) – The RF model to fit.
data (jnp.ndarray | skrf.Network | NetworkCollection) – The data to fit to. Can either be a JAX array, a
skrf.Network, or apmrf.NetworkCollection.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=ScipyMinimizer()) – The optimizer to use. Can be either in instance of
pmrf.optimize.ScipyMinimizeror a minimizer from Optimistix (such asoptimistix.LBFGS).features (str | list[str] | Callable[[Model, Frequency], jnp.ndarray], default='s') – The RF features to fit. Can either be function, a callable PyTree with optional parameters, or a string, in which case a feature evaluator is created (see
pmrf.evaluators.Feature). Defaults to all S-parameters.loss_fn (str | Callable, default=RMSELoss()) – The loss function between the model prediction and the data. Can be a function, a callable PyTree with optional parameters, or a string for a lookup into
pmrf.math.LOSS_LOOKUPSeepmrf.lossesfor common losses. Defaults to None, in which casepmrf.losses.RMSELossis used.multioutput (Aggregation, optional) – An additional key-word parameter to optionally pass to loss_fn indicating how to aggregate outputs. For the default of None, the argument is not passed.
scale_fn (str | Callable, default=None) – A scaling to apply to the output metric after aggregation. Can be a string for a lookup into
pmrf.math.CONVERSION_LOOKUP.**kwargs (dict) – Additional keyword arguments passed to the underlying solver.
- Returns:
The optimization result containing the fitted Model.
- Return type: