Skip to main content
Every time Nori looks at a row, it builds a dense vector for it, a learned representation shaped by how that row relates to the target and to the rest of your table. Pull those vectors out and they become features you can drop into anything downstream.

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

1

Install the package

The base install is all you need to extract vectors and fit downstream heads (scikit-learn is a core dependency).
2

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.
3

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.
4

Use them as features

The result is a plain 2-D matrix, so any scikit-learn estimator takes it from here, for example a nearest-neighbor regressor:

Pick your extraction API

Leak-free or fast: choose per use

The n_fold setting is the one decision that matters. It trades a bit of compute for an honest downstream score.
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).
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 the eval extra, and run:
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.
t-SNE of raw features vs Nori embeddings on a synthetic dataset
Rolling your own plot is three lines once you have Z_test:

API reference

ParameterDefaultDescription
n_fold0CV folds. 0 = vanilla (single model); >= 2 = out-of-fold training embeddings.
modelNoneA pre-configured NoriRegressor. Built at fit time when None.
shuffleFalseShuffle the K-fold split.
random_stateNoneSeed for the split when shuffle=True.
After fit, the transformer exposes model_ (the full-data model) and train_embeddings_ (out-of-fold when n_fold >= 2).
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.