fitbenchmarking.cost_func.base_cost_func module
Implements the base class for the cost function class.
- class fitbenchmarking.cost_func.base_cost_func.CostFunc(problem)
Bases:
object
Base class for the cost functions.
- abstract eval_cost(params, **kwargs)
Evaluate the cost function
- Parameters
params (list) – The parameters to calculate residuals for
- Returns
evaluated cost function
- Return type
float
- abstract hes_cost(params, **kwargs)
Uses the Hessian of the model to evaluate the Hessian of the cost function, \(\nabla_p^2 F(r(x,y,p))\), at the given parameters.
- Parameters
params (list) – The parameters at which to calculate Hessians
- Returns
evaluated Hessian of the cost function
- Return type
2D numpy array
- abstract hes_res(params, **kwargs)
Uses the Hessian of the model to evaluate the Hessian of the cost function residual, \(\nabla_p^2 r(x,y,p)\), at the given parameters.
- Parameters
params (list) – The parameters at which to calculate Hessians
- Returns
evaluated Hessian and Jacobian of the residual at each x, y pair
- Return type
tuple (list of 2D numpy arrays, list of 1D numpy arrays)
- abstract jac_cost(params, **kwargs)
Uses the Jacobian of the model to evaluate the Jacobian of the cost function, \(\nabla_p F(r(x,y,p))\), at the given parameters.
- Parameters
params (list) – The parameters at which to calculate Jacobians
- Returns
evaluated Jacobian of the cost function
- Return type
1D numpy array
- abstract jac_res(params, **kwargs)
Uses the Jacobian of the model to evaluate the Jacobian of the cost function residual, \(\nabla_p r(x,y,p)\), at the given parameters.
- Parameters
params (list) – The parameters at which to calculate Jacobians
- Returns
evaluated Jacobian of the residual at each x, y pair
- Return type
a list of 1D numpy arrays
- validate_algorithm_type(algorithm_check, minimizer)
Helper function which checks that the algorithm type of the selected minimizer from the options (options.minimizer) is incompatible with the selected cost function
- Parameters
algorithm_check – dictionary object containing algorithm
types and minimizers for selected software :type algorithm_check: dict :param minimizer: string of minimizers selected from the options :type minimizer: str