ScipyMinimize
- class pmrf.optimize.ScipyMinimize(method: str | None = None, tol: float | None = None, options: dict = <factory>, show_progress: bool = True)
Bases:
AbstractBoundedMinimizerA wrapper around SciPy’s
scipy.optimize.minimize().Acts as an adapter layer between JAX’s PyTrees and SciPy’s required flat 1D NumPy arrays. Handles automatic differentiation implicitly via JAXopt.
- Parameters:
method (str, optional) – Type of solver, pass None to use SciPy defaults.
tol (float, optional) – Tolerance for termination.
options (dict, optional) – A dictionary of solver options.
show_progress (bool, default=True) – Whether to show a progress bar during optimization.
- run(fn: Callable[[PyTree, Any], Any], y0: PyTree, args: Any = None, bounds: tuple[PyTree, PyTree] | None = None, max_iter: int = 1024, **kwargs) tuple[MinimizeResult, PyTree]
Execute the minimization algorithm.
- Parameters:
fn (callable) – The objective function to minimize.
y0 (PyTree) – The initial parameter guess.
args (Any) – Args to pass to fn.
bounds (PyTree) – Bounds for y0, if any.
max_iter (int = 1024) – The maximum number of iterations to take.
**kwargs – Runtime arguments forward to the solver backend.
- Returns:
A tuple of (
pmrf.optimize.MinimizeResult, metrics)`.- Return type:
tuple
- method: str | None = None
- options: dict
- show_progress: bool = True
- tol: float | None = None