monotonicity_#
- pygam.penalties.monotonicity_(n, coef, increasing=True)[source]#
Builds a penalty matrix for P-Splines with continuous features. Penalizes violation of monotonicity in the feature function.
- Parameters:
- nint
number of splines
- coefarray-like
coefficients of the feature function
- increasingbool, default: True
whether to enforce monotic increasing, or decreasing functions
- Returns:
- penalty matrixsparse csc matrix of shape (n,n)