fitter
Abstraction usefull for the calibration of the closures.
This module contains the classes FittableParameter and FittableParametersSet which
are used to make a link between the optimization part and the closures structures. These class can
be obtained by the prefix tunax.fitter. or directly by tunax..
- class FittableParameter[source]
Calibration configuration for one parameter.
An instance of this class must be created for every parameter of the closure that will be calibrated and for every not default values during calibration. The constructor takes all the attributes as parameters.
- class FittableParametersSet[source]
Complete closure calibration parameters.
This class is the set of all the configurations on the closure parameters for the calibration. It makes the link between the array on which the optimizer works and the closure parameters class.
- Parameters:
coef_fit_dict (Dict[str, FittableParameter]) – cf.
coef_fit_dict.closure_name (str) – Name of the chosen closure, must be a key of
CLOSURES_REGISTRY, see its documentation for the available closures.
- coef_fit_dico
The set of all the configurations of all the parameters that will be calibrated and the one constants but not with the default value of the closure.
- Type:
Dict[str, FittableParameter]
- property n_calib: int
Number of variables that are calibrated.
- Returns:
nc – Number of variables that are calibrated.
- Return type:
- fit_to_closure(x)[source]
Transforms an fitted array in a set of closure parameters.
This method copy the fixed non-default values of
coef_fit_dictand copy the calibrated values fromx. Which is simply the parameters values in the order that is indicated bycoef_fit_dict.- Parameters:
x (float
Arrayof shape (nc)) – The array on which the optimize works to find the best values. It is the array of the parameters that are calibrated.- Returns:
clo_params – The instance of the closure parameters class (child class of
ClosureParametersAbstract) with the modifications of the calibration step.- Return type:
- gen_init_val()[source]
Produce the fitted array for the first calibration step.
This method simply copy the initial values of the calibrated coefficients in an array
xwhich will be used as the first calibration step for the optimizer.- Returns:
x – The initial vector for the optimizer at the first step of calibration.
- Return type:
float
Arrayof shape (nc)