calibr8.optimization
The optimization module implements convenience functions for maximum likelihood estimation of calibration model parameters.
- calibr8.optimization.fit_scipy(model: CalibrationModel, *, independent: ndarray, dependent: ndarray, theta_guess: Sequence[float] | ndarray, theta_bounds: Sequence[Tuple[float, float]], minimize_kwargs: Mapping[str, Any] | None = None)
Function to fit the calibration model with observed data.
- Parameters:
- modelcalibr8.CalibrationModel
the calibration model to fit (inplace)
- independentarray-like
desired values of the independent variable or measured values of the same
- dependentarray-like
observations of dependent variable
- theta_guessarray-like
initial guess for parameters describing the PDF of the dependent variable
- theta_boundsarray-like
bounds to fit the parameters
- minimize_kwargsdict
keyword-arguments for scipy.optimize.minimize
- Returns:
- thetaarray-like
best found parameter vector
- historylist
history of the optimization
- calibr8.optimization.fit_scipy_global(model: CalibrationModel, *, independent: ndarray, dependent: ndarray, theta_bounds: list, method: str | None = None, maxiter: int = 5000, minimizer_kwargs: Mapping[str, Any] | None = None)
Function to fit the calibration model with observed data using global optimization.
- Parameters:
- modelcalibr8.CalibrationModel
the calibration model to fit (inplace)
- independentarray-like
desired values of the independent variable or measured values of the same
- dependentarray-like
observations of dependent variable
- theta_boundsarray-like
bounds to fit the parameters
- method: str, optional
- Type of solver. Must be one of the following:
"dual_annealing"
If not given, defaults to
"dual_annealing"
.- maxiter: int, optional
Maximum number of iterations of the dual_annealing solver. If not given, defaults to 5000.
- minimize_kwargsdict
keyword-arguments for scipy.optimize.minimize
- Returns:
- thetaarray-like
best found parameter vector
- historylist
history of the optimization, containing best parameter, objective value, and solver status
- Raises:
- ValueError
user input does not match number of parameters
- ValueError
user specifies not supported optimization method
- Warning
fit failed or bounds constrain optimization