deerlab.Penalty#

class Penalty(penaltyfcn, selection, description=None, signature=None)[source]#

Represents a penalty term of the objective function.

Attributes:
weightParameter instance

Penalty weight parameter (a Parameter object instance without the linear and par0 attributes).

descriptionstring

Description of the penalty.

selectionstring

Name of the selection functional for the penalty weight optimization.

Methods table#

__init__(penaltyfcn, selection[, ...])

Construct a new penalty object.

optimize(fitfcn, y, sigma)

Optimize the penalty weight.

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 penaltyfcn function 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.

Inherited Methods#