Shape-Prior-Embedded Regression Models#
SPERM embeds global shape knowledge into familiar regression models. Add value bounds, monotonicity, slope bounds, unimodality, or convexity through one consistent, scikit-learn-compatible API.
from sperm.linear_model import Ridge
from sperm.priors import Increasing, Lipschitz
model = Ridge(
priors={0: (Increasing(), Lipschitz(2))}
).fit(X, y)
y_pred = model.predict(X_test)
Install SPERM, fit your first constrained model, and learn how priors are attached to features.
One Prior Language, Four Model Families#
Affine regression with exact coefficient constraints.
Decision trees, random forests, and gradient boosting.
Shape-preserving MLP and input-convex architectures.
Analytic uncertainty with a globally constrained posterior mean.
Shape Guarantees Are Part of the Model#
Priors are enforced over the complete input space, not checked only at the training samples. SPERM validates combinations before fitting and rejects requirements that would make a model trivial or mathematically inconsistent.
Learn which properties are output-wide, feature-wise, or cross-feature.
Compare constrained and unconstrained regressors on reproducible experiments.
Browse public estimators, prior primitives, parameters, and methods.