minimize
- pmrf.optimize.minimize(objective: Callable[[PyTree], Array] | tuple[Callable, Frequency] | Sequence[Callable[[PyTree], Array] | tuple[Callable, Frequency]], model: PyTreeT | None = None, frequency: Frequency | None = None, solver: AbstractUnconstrainedMinimizer | AbstractBoundedMinimizer = ScipyMinimize(options={}), max_iter: int | None = 1024, **kwargs) OptimizeResult[PyTreeT]
Minimizes a given objective function for a model over a frequency range.
The objective function can have its own hyper-parameters, and is returned in result.objective.
- Parameters:
objective (TermLike | Sequence[TermLike] | pmrf.AbstractProblem) –
An already-built problem, or the objective function to minimize. Can be a function or a callable PyTree with optional parameters. If a sequence of objectives is provided, they are automatically summed. See
pmrf.evaluators.Goal()for an easy way to define goal-based objectives.Each objective may instead be an
(objective, frequency)pair, or apmrf.Term, binding it to its own frequency sweep rather than the shared one. This allows a single parameter set to be optimized against several bands at once.model (PyTree | None, default=None) – The PyTree containing the parameters to be optimized. Omitted when an already-built problem is passed. If the parameters contain bounds and the optimizer supports bounds, these bounds are used in a bounded optimization. Otherwise, the bounds are enforced via space transformations (bijectors). If the parameters do not contain bounds, their limits are set to infinity.
frequency (Frequency | None, default=None) – The frequency sweep over which the objective should be evaluated. May be omitted only if every objective already carries its own frequency.
solver (pmrf.optimize.AbstractMinimizer, default=ScipyMinimize()) – The optimizer to use. See
pmrf.optimizefor available solvers.max_iter (int) – The maximum number of iterations to take.
**kwargs – Additional arguments to forward to parax.optimize.minimize.
- Returns:
A structured result containing the fitted model and solver statistics.
- Return type: