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)
Start in minutes

Install SPERM, fit your first constrained model, and learn how priors are attached to features.

Getting started

One Prior Language, Four Model Families#

Linear models

Affine regression with exact coefficient constraints.

Linear Models
Tree models

Decision trees, random forests, and gradient boosting.

Tree Models
Neural networks

Shape-preserving MLP and input-convex architectures.

Neural Networks
Gaussian processes

Analytic uncertainty with a globally constrained posterior mean.

Gaussian Processes

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.

Understand the semantics

Learn which properties are output-wide, feature-wise, or cross-feature.

Shape Priors
Explore complete examples

Compare constrained and unconstrained regressors on reproducible experiments.

Examples
Use the Python API

Browse public estimators, prior primitives, parameters, and methods.

API Reference