wrap_penalty#

pygam.penalties.wrap_penalty(p, fit_linear, linear_penalty=0.0)[source]#

Tool to account for unity penalty on the linear term of any feature.

example:

p = wrap_penalty(derivative, fit_linear=True)(n, coef)

Parameters:
pcallable.

penalty-matrix-generating function.

fit_linearboolean.

whether the current feature has a linear term or not.

linear_penaltyfloat, default: 0.

penalty on the linear term

Returns:
wrapped_pcallable

modified penalty-matrix-generating function