minimize

minimize(cost_fn, model, frequency, solver=ScipyMinimizer(options={}), *, transform=None, max_steps=10000, **kwargs)[source]

Minimizes a given cost function for a model over a frequency range.

The cost function can have its own hyper-parameters, and is returned in result.cost.

Parameters:
  • cost_fn (Callable[[Model, Frequency], jnp.ndarray] | list[Callable],) – The cost function to minimize. Must be a callable or PyTree with signature (model, freq) -> jnp.ndarray. If a list of costs is provided, they are automatically summed. See :meth:pmrf.evaluators.Goal for an easy way to define goal-based cost functions.

  • model (Model) – The RF model containing the parameters to be optimized.

  • frequency (Frequency) – The frequency sweep over which the cost should be evaluated.

  • solver (optx.AbstractMinimiser | Callable, default=ScipyMinimizer()) – The optimization backend to use. Defaults to the host-based SciPy L-BFGS-B.

  • transform (distreqx.bijectors.AbstractBijector, default=None) – An invertible transformation to apply to all model parameters before optimization.

  • max_steps (int, default=256) – The maximum number of steps/iterations the underlying solver can take.

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

Returns:

A structured result containing the fitted model and solver statistics.

Return type:

OptimizeResult