Downstream models
Feed the vectors to a kNN, linear probe, or gradient-boosting head, often
matching Nori’s own accuracy with a model you fully control.
Similarity & search
Nearest-neighbor lookup in embedding space finds rows that are behaviorally
alike, not just numerically close.
Clustering
Cluster on the embeddings to segment rows by what actually drives the target.
Visualization
Project to 2-D and watch the target structure appear. See the
gallery below.
Nori is regression-only, so every embedding is conditioned on a continuous
target. Extraction runs on the local
synthefy-nori package (not the hosted
API) and needs no API key. Weights download from Hugging Face on first use.Extract embeddings in four steps
Install the package
The base install is all you need to extract vectors and fit downstream heads
(scikit-learn is a core dependency).
Fit and pull out-of-fold vectors
NoriEmbedding is a scikit-learn transformer. With n_fold >= 2,
fit_transform returns leak-free training embeddings (each row embedded
by a model that never saw its label), and transform embeds unseen rows with
the final full-data model.Collapse the ensemble to a 2-D matrix
Both calls return a 3-D array
(n_estimators, n_samples, embed_dim), one
slice per preprocessing pipeline in the inference ensemble. Average over
axis 0 (or pick one member) for a matrix any estimator can consume.Pick your extraction API
- NoriEmbedding (recommended)
- get_embeddings (low-level)
The sklearn transformer. Handles the fold logic and the final full-data fit
for you, so training embeddings stay leak-free.
| Method | Returns |
|---|---|
fit_transform(X_train, y_train) | training embeddings (out-of-fold when n_fold >= 2) |
transform(X) | embeddings for unseen rows, always from the full-data model |
Leak-free or fast: choose per use
Then_fold setting is the one decision that matters. It trades a bit of compute
for an honest downstream score.
Out-of-fold (n_fold ≥ 2), for when you train on the rows
Out-of-fold (n_fold ≥ 2), for when you train on the rows
K-fold cross-validation: each training row is embedded by a fold model that
did not have it in context, so the vector never leaks that row’s own
label. Unseen rows are then embedded by a single model fit on the full
training set. This is what gives a downstream probe an unbiased estimate of
generalization (arXiv:2502.17361).
Vanilla (n_fold = 0), for a quick one-shot embed
Vanilla (n_fold = 0), for a quick one-shot embed
One model is fit on the whole training set and used for every row. It is
cheaper (a single fit instead of
n_fold + 1), but the training embeddings
encode their own labels. Fine for visualization or embedding brand-new rows;
don’t fit a downstream model on vanilla training embeddings and trust the
score.See it on real data
Because the vectors are organized by the target, a 2-D t-SNE of Nori embeddings separates rows by their target value far more cleanly than a t-SNE of the raw features. Both runnable examples below produce exactly these plots. Clone the repo, install theeval extra, and run:
- Synthetic dataset
- Real dataset (TabArena)
examples/embedding_synthetic.py
runs the workflow on a small synthetic regression target: it extracts
embeddings, runs a kNN probe, and draws the t-SNE. Fast, with no data
download.
Z_test:
API reference
NoriEmbedding parameters
NoriEmbedding parameters
| Parameter | Default | Description |
|---|---|---|
n_fold | 0 | CV folds. 0 = vanilla (single model); >= 2 = out-of-fold training embeddings. |
model | None | A pre-configured NoriRegressor. Built at fit time when None. |
shuffle | False | Shuffle the K-fold split. |
random_state | None | Seed for the split when shuffle=True. |
fit, the transformer exposes model_ (the full-data model) and
train_embeddings_ (out-of-fold when n_fold >= 2).Downstream head snippets
Downstream head snippets
A standardized ridge probe (good default for the higher-dimensional
embeddings of real data):The same
Z_train / Z_test matrices feed clustering (KMeans), nearest-
neighbor search (NearestNeighbors), or any 2-D projection.Shapes at a glance: embeddings are
(n_estimators, n_samples, embed_dim).
Average over axis=0 (or select [0]) before handing them to a 2-D estimator.