Objective functions and constraints

smoother.DerivativeObjective

class smoother.DerivativeObjective(d=1, weight=None) [source]

A Smoother objective function which minimizes the sum of a square derivative.

Parameters and attributes: d : int, default=1

e.g. 1 means first derivative, 2 means second derivative.

Methods

__call__(self, smoother) [source]

Parameters: smoother : Smoother

The smoother to which this objective function applies.

Returns: value : float

Approximate mean square derivative over all points of the distribution.

smoother.MassConstraint

class smoother.MassConstraint(lb, ub, mass, weight=None) [source]

A Smoother constraint that forces a certain amount of probability mass to be within a given range.

Parameters and attributes: lb : float

Lower bound of the range within which the probability mass must be.

ub : float

Upper bound of the range within which the probability mass must be.

mass : float between 0. and 1.

Amount of probability mass between lb and ub.

weight : float or None, default=None

Weight to place on the constraint. If None the weight will be set automatically when the constraint is called based on the smoother.

Methods

__call__(self, smoother) [source]

Parameters: smoother : Smoother

Smoother to which this constraint applies.

Returns: loss : float

smoother.MomentConstraint

class smoother.MomentConstraint(value, degree, type_='raw', norm=False, weight=None) [source]

A Smoother constraint that forces a moment condition to hold.

Parameters and attributes: value : float

The target value of the moment.

degree : int

The degree of the moment; e.g. the 1st moment is the mean.

type_ : str, default='raw'

Type of moment: 'raw', 'central' or 'standardized'.

norm : bool, default=False

Indicates whether to apply a norm to the moment.

weight : float or None, default=None

Weight to place on the constraint. If None the weight will be set automatically when the constraint is called based on the smoother.

Methods

__call__(self, smoother) [source]

Parameters: smoother : Smoother

Smoother to which this constraint applies.

Returns: loss : float