Skip to main content
ByPrior Labs
Going beyond point estimates to the full predictive distribution. A TabPFN regressor does not just output a single number per row. It predicts a full distribution over the target, which we can summarise as a mean, read off at chosen quantiles, or visualise directly. To generate point-estimates the TabPFNRegressor object takes the mean of the predicted distribution. This notebook captures that full output, inspects its structure, and uses it to draw calibrated uncertainty bands around the model’s predictions. We run the regressor through the hosted API client (tabpfn-client); the same code works with the local tabpfn package by changing the import.

Setup

Installing the TabPFN client and the plotting dependencies.

Imports and Data

Loading the diabetes dataset and the distribution plotting helper. The regressor comes from the hosted client (tabpfn_client). Alongside it we import plot_regression_distribution from the open-source tabpfn package, a helper that draws TabPFN’s predicted distribution for a single sample.

Authenticating with a Token

Setting TABPFN_TOKEN so the client can reach the API.

Fit the Regressor

A small ensemble keeps the full-distribution output light. Each estimator contributes its own predicted distribution, and the final output combines them. We use four here.

Capturing the Full Output

Requesting output_type="full" returns a dictionary, not an array. Instead of one prediction per row, the full output exposes every summary TabPFN computes, keyed by name.

Inspecting the Output

The mean and the predicted quantiles, side by side. mean holds the point estimate per row. quantiles holds the predicted value at each default quantile, from the 10th to the 90th percentile.

Visualising a Single Prediction

Plotting the full predicted distribution for one row. plot_regression_distribution shows the shape of the distribution TabPFN assigns to a single sample, making its confidence, or lack of it, visible at a glance.
Predicted distribution for sample 0
Predicted distribution for sample 10

Uncertainty Across the Input Range

Building an uncertainty band on a controlled synthetic dataset. To see how the input affects the uncertainty in the prediction, we generate data where the noise grows with the input.

Generate the data

A linear trend with noise that widens as X grows.

Generate predictions

Mean predictions, plus the full distribution for the quantiles.

Plot the uncertainty band

Shading between the 10th and 90th predicted quantiles. The band widens where the model is less certain, including the extrapolation region past the training data.
Uncertainty band plot