convex#

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

Builds a penalty matrix for P-Splines with continuous features. Penalizes violation of a convex feature function.

Parameters:
nint

number of splines

coefarray-like

coefficients of the feature function

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