Parameter Estimators

class ionworkspipeline.ParameterEstimator(**kwargs: Any)

Base class for all parameter estimators. Parameter estimators find an optimal set of parameters by minimizing an objective function.

Subclasses should override: - run(): Execute the estimation algorithm - Class attributes for capabilities (scalar_output, probabilistic, etc.)

Parameters

**kwargs

Arguments passed to the underlying estimation algorithm.

Extends: ionworkspipeline.controllers.ConfigMixin

property cost: ObjectiveFunction | None

Cost function used by the estimator.

property gradient: Callable[[ndarray], ndarray]

Objective function gradient (uses finite differences if not provided).

property objective_and_gradient: Callable[[ndarray], tuple[float, ndarray]]

Objective function and gradient (uses finite differences if not provided).

run(x0: ndarray) Any

Run the estimator. Must be implemented by the subclass.

Parameters

x0array_like

Initial guess for the independent variables.

Returns

res

OptimizerResult or SamplerResult depending on estimator type.

set_bounds(bounds: tuple[ndarray, ndarray]) None

Set the bounds using the correct format for the estimator.

Converts from canonical (lower_array, upper_array) to estimator-specific format.

set_data_fit(data_fit: Any) None

Set the associated DataFit object.

set_eq_constraints(eq_constraints: list[Callable]) None

Set equality constraint functions (should evaluate to zero).

Raises NotImplementedError if the estimator doesn’t support custom constraints.

set_gradient(gradient: Callable[[ndarray], ndarray]) None

Set the objective function parameter gradient.

set_ineq_constraints(ineq_constraints: list[Callable]) None

Set inequality constraint functions (should evaluate to > 0).

Raises NotImplementedError if the estimator doesn’t support custom constraints.

set_objective(objective: Callable[[ndarray], float | ndarray]) None

Set the objective function to be minimized.

set_objective_and_gradient(objective_and_gradient: Callable[[ndarray], tuple[float, ndarray]]) None

Set the objective function and its parameter gradient.

to_config() dict

Convert the parameter estimator back to parser configuration format.

Returns

dict

Configuration dictionary that can be passed to parse_optimizer

class ionworkspipeline.parameter_estimators.Chain(*estimators)

Chain of estimators to be run in sequence, where the output of one estimator is the initial guess for the next estimator.

Parameters

*estimatorslist of estimator objects

The estimators to be run in sequence.

Extends: builtins.list

property cost

If all estimators have the same default cost function, return it. Otherwise, raise an error.

run(x0)

Optimize the objective function by running each estimator in sequence.

Parameters

x0array_like

Initial guess for the independent variables.

Returns

resionworkspipeline.estimatorResult

The result of the optimization.