Refresh-aware basis adaptation
Landmarks, anchors, calibration, and fusion refresh only when drift exceeds a threshold — with cooldown, warmup, hysteresis, and an amortized budget.
Train a low-rank kernel regressor on large batches or streaming data without rebuilding its basis at every update. Kernos keeps learning continuously and refreshes landmarks only when they drift.Under the hood: refresh-aware hybrid continuous-discrete kernel learning, exposed through a familiar scikit-learn-style API.
import numpy as np
from kernos import Kernos
rng = np.random.default_rng(42)
X_train = rng.standard_normal((80, 4))
y_train = X_train[:, 0] + 0.5 * X_train[:, 1] ** 2 + 0.1 * rng.standard_normal(80)
X_test = rng.standard_normal((20, 4))
y_test = X_test[:, 0] + 0.5 * X_test[:, 1] ** 2 + 0.1 * rng.standard_normal(20)
model = Kernos(
dim=4,
mbasis=16,
abasis=4,
lk=4,
ridge=1e-2,
steps=1,
seed=42,
).fit(X_train, y_train)
print(f"R² on held-out: {model.score(X_test, y_test):.4f}")
# The score depends on the dataset, seed and training budget.Built on the shoulders of
Every piece of Kernos is engineered for one thing: an adaptive, low-rank kernel that learns continuously and refreshes only when it has to.
Landmarks, anchors, calibration, and fusion refresh only when drift exceeds a threshold — with cooldown, warmup, hysteresis, and an amortized budget.
A familiar `fit` / `predict` / `score` surface that integrates with `GridSearchCV` and `Pipeline` when the configured basis and validation capacity fit the dataset.
An explicit-feature kernel with PSD guarantee, a rank bound, and SPD normal equations. Calibration scalars stay bounded away from zero.
Cached `O(nm)` for in-core work and streamed `O(m²)` for large data and online learning — same algorithm, different memory budget.
Anchor sampling weighted by residual magnitude, k-NN sparse RBF features, and orthogonalization that keeps local features in the global nullspace.
Eigenvalue clipping, soft spectral truncation, Cholesky with jitter fallback, and preconditioned conjugate gradient for ill-conditioned solves.
Kernos splits every parameter into a continuously-learned group and a discretely-refreshed group. The expensive refresh fires only when the basis drifts past a threshold you control.
Each step, the continuous parameters learn by gradient descent. Periodically, a drift-aware controller decides whether to refresh the discrete basis — gated by cooldown, warmup, hysteresis, and an amortized refresh budget.
Updated via gradient descent on the validation loss.
Refreshed only when basis drift exceeds a learned threshold.
Project input space into a continuous embedding.
Global Nyström landmarks via k-means++ and spectral whitening.
Residual-aware anchors + orthogonalized local features.
Trace-based calibration + logistic gate across global and local.
Direct, iterative, or Jacobi ridge solve on ΦᵀΦ + λI.
Explicit rank bound: global Nyström landmarks plus local corrective rank.
Constructed as a product of explicit features. Positive semidefinite by construction.
Local features live in the global nullspace, kept stable by ridge regularization.
Kernos was evaluated against Ridge, Nyström, and Random Fourier Features on nine real-world regression datasets. The refresh-aware variant beats the best non-refresh baseline on average — and wins more often than it loses.
Summary scope: Small budget tier, five controlled CPU seeds, mean RMSE across the evaluated datasets. Results are descriptive; hardware and dataset changes can alter the outcome.





On this recorded sweep, disabling refresh improves RMSE for some datasets. Treat refresh as a controllable adaptation mechanism and validate it against your workload rather than assuming it always improves accuracy.
Lower rank is better. Across nine datasets, Kernos lands in the top half of eleven models on every one.
kernos-eval --datasets WineQuality --tiers Small --n_seeds 2kernos-analyze --results results/results.csvSplits: 70 / 15 / 15 train, validation and test, scaled on train only.
Stability: five controlled CPU seeds; tables report mean ± standard deviation.
Budgets: Small, Medium and Large tiers vary basis size and training horizon.
Metrics: RMSE, train time, peak Python allocation, refresh count and condition proxy. Native RSS is not measured in this table.
These headline aggregates are descriptive, not a guarantee for every dataset or hardware configuration. Re-run the pinned protocol before drawing a performance conclusion.
Use Kernos through a familiar scikit-learn-style estimator API. Tune it withGridSearchCV. Stream it with partial_fit. Drop it into a Pipeline.
import numpy as np
from kernos import Kernos
rng = np.random.default_rng(42)
X_train = rng.standard_normal((80, 4))
y_train = X_train[:, 0] + 0.5 * X_train[:, 1] ** 2 + 0.1 * rng.standard_normal(80)
X_test = rng.standard_normal((20, 4))
y_test = X_test[:, 0] + 0.5 * X_test[:, 1] ** 2 + 0.1 * rng.standard_normal(20)
model = Kernos(
dim=4,
mbasis=16,
abasis=4,
lk=4,
ridge=1e-2,
steps=1,
seed=42,
).fit(X_train, y_train)
print(f"R² on held-out: {model.score(X_test, y_test):.4f}")
# The score depends on the dataset, seed and training budget.Kernos ships on PyPI. Python 3.10 or newer, NumPy, SciPy, and scikit-learn — that's it.