deerlab.Penalty¶
- class Penalty(penaltyfcn, selection, description=None, signature=None)[source]¶
Represents a penalty term of the objective function.
- Attributes:
- weight
Parameterinstance Penalty weight parameter (a
Parameterobject instance without thelinearandpar0attributes).- descriptionstring
Description of the penalty.
- selectionstring
Name of the selection functional for the penalty weight optimization.
- weight
Methods table¶
Methods¶
- Penalty.__init__(penaltyfcn, selection, description=None, signature=None)[source]¶
Construct a new penalty object.
- Parameters:
- penaltyfcncallable
Function that takes a set of parameters and returns a vector that will internally be squared and appended to the least-squares residual vector. The names of the arguments defined in the function signature must match the names of the parameter in the model used along the penalty.
- selectionstring
Selection functional for the outer optimization of the penalty weight.
'aic'- Akaike information criterion'bic'- Bayesian information criterion'aicc'- COrrected Akaike information criterion'icc'- Informational complexity criterion
- descriptionstring, optional
Description of the penalty.
- signaturelist of strings
Signature of the
penaltyfcnfunction to manually specify the names of the input arguments. For internal use (mostly).
- Penalty.optimize(fitfcn, y, sigma)[source]¶
Optimize the penalty weight.
- Parameters:
- fitfcncallable
Fit function taking a penalty weight value. Must return a deerlab.FitResult object.
- yarray_like
Dataset being fitted
- sigmascalar
Estimated noise level (standard deviation).
- Returns:
- fitdeerlab.FitResult
Fit at the optimized penalty weight.
- weightoptscalar
Optimized penalty weight.