Gaussian Processes for small nonlinear data, with adaptive kernels and calibrated intervals.
SmallGP is a library for small nonlinear regression (
- No kernel tuning. Lengthscale initialized from data statistics.
- Calibrated intervals. Conformal wrapper on top of GP posterior.
-
Sparse variant for
$n > 500$ via inducing points. -
Scikit-learn compatible API (
fit/predict/predict_interval).
Gaussian Processes are the natural choice for small nonlinear data — they provide calibrated uncertainty, work with few samples, and have strong theoretical foundations. But two things stop people from using them in practice:
| Problem | Standard GP | SmallGP |
|---|---|---|
| Kernel lengthscale must be tuned | ✗ | ✓ |
|
|
✗ | ✓ (sparse) |
| Works with |
✓ | ✓ |
| Calibrated prediction intervals | ✓ | ✓ |
| Scikit-learn API | ✗ | ✓ |
Adaptive by construction. Lengthscale, noise, and inducing point count are derived from dataset parameters — not searched.
Planning stage. This repository is a placeholder for future development.
Planned milestones:
- Adaptive lengthscale initialization from
$n$ ,$d$ , target scale - Full GP baseline (exact inference)
- Sparse GP via inducing points (
$m \approx \sqrt{n}$ ) - Conformal wrapper for calibrated intervals
- Benchmark against SmallMLP, GPy, scikit-learn GP
- PyPI release
See CHANGELOG.md for progress.
import numpy as np
from smallgp import SmallGPRegressor
X = np.random.randn(200, 5)
y = np.sin(X[:, 0]) + 0.1 * np.random.randn(200)
model = SmallGPRegressor() # adaptive kernel, exact inference
model.fit(X, y)
y_hat = model.predict(X)
lo, hi = model.predict_interval(X, alpha=0.1)Sparse variant:
model = SmallGPRegressor(sparse=True) # inducing points, n > 500Kernel lengthscale initialized from data statistics:
with per-feature ARD refinement via marginal likelihood on a validation split.
Observation noise initialized as a fraction of target variance:
For
Optimize inducing point locations via marginal likelihood.
Same weighted conformal approach as SmallMLP: locally adaptive intervals via an embedding kernel.
Good fit:
- Small datasets (
$n < 500$ ) with smooth nonlinear structure. - Scientific instruments: sensors, spectroscopy, chemistry.
- When calibrated uncertainty matters.
- When you want theory-backed predictions (GP posterior).
Not a good fit:
- Non-smooth functions — GPs assume smoothness.
- Very high dimensions (
$d > 100$ ) with tiny$n$ . - Large datasets (
$n > 10{,}000$ ) — use sparse GP or neural networks.
| Milestone | Status |
|---|---|
| Adaptive lengthscale | planned |
| Exact GP baseline | planned |
| Sparse GP | planned |
| Conformal wrapper | planned |
| Benchmark (45 datasets) | planned |
| PyPI release | planned |
| arXiv preprint | planned |
- SmallGBM — gradient boosting for small tabular data. GitHub
- SmallMLP — adaptive MLP for small nonlinear data. GitHub
Part of the Small ML series: tuning-free models for small data.
MIT License. See LICENSE for details.
Built independently during undergraduate studies at Beijing Institute of Technology.