l2#

pygam.penalties.l2(n, coef)[source]#

Builds a penalty matrix for P-Splines with categorical features. Penalizes the squared value of each basis coefficient.

Parameters:
nint

number of splines

coefunused

for compatibility with constraints

Returns:
penalty matrixsparse csc matrix of shape (n,n)