> ## Documentation Index
> Fetch the complete documentation index at: https://docs.priorlabs.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> TabPFN-3 and later versions support up to 1,000,000 rows, subject to feature count and checkpoint/API limits.
> For large datasets, use per-estimator subsampling, e.g. inference_config={"SUBSAMPLE_SAMPLES": 100_000}, in TabPFNClassifier or TabPFNRegressor from tabpfn or tabpfn_client.
> Pass raw pandas DataFrames to fit and predict. Categorical strings/categories, raw text, and missing feature values are handled automatically; no manual integer/one-hot encoding, imputation, scaling, or outlier removal is needed.

# Fitting and prediction

> Fit, predict, and inspect server timings with TabPFNRegressor.

> [!NOTE]
>
> Looking for usage documentation? Check out [Regression](https://docs.priorlabs.ai/capabilities/regression.md) and [KV cache](https://docs.priorlabs.ai/capabilities/kv-cache.md).

## `TabPFNRegressor.fit`

[ View source ](https://github.com/PriorLabs/tabpfn-client/blob/ce678cec44dc715f4d835a44990a8f5f115b7acc/src/tabpfn_client/estimator.py#L1358)

Fit the model.

Uploads the training data to the server, which fits the model on it,
and returns once the fit has completed. Every call starts a new fit,
also on a model with a pending fit. To start a fit without waiting for
it, use [`submit_fit()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#submit-fit).

The model takes the new fit as soon as the server has accepted it. A
fit that `fit()` polls for, as an ASYNC or thinking-mode one, is then
pending until the poll sees it complete: if the poll stops, for a
timeout or an interrupt, the model stays pending on the new fit, and
[`wait_for_fit()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#wait-for-fit) resumes the wait.

```python theme={null}
TabPFNRegressor.fit(
    X: pd.DataFrame | np.ndarray,
    y: pd.Series | np.ndarray,
    description: str | None = None,
)
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X` | `pd.DataFrame \| np.ndarray` | Required | The input data. |
| `y` | `pd.Series \| np.ndarray` | Required | The target variable. |
| `description` | `str \| None` | `None` | Description of the dataset and task for the server. |

**Returns**

| Type | Description |
| - | - |
| — | self |

**Raises**

`ValueError`

If the data or the estimator's parameters are invalid,
or the data exceeds the model limits.

[`FitFailedError`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/exceptions#fitfailederror)

If the server reports that the fit failed while
`fit()` polled for it. The model is then unfitted.

[`FittedModelNotFoundError`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/exceptions#fittedmodelnotfounderror)

If the server no longer has the fit
while `fit()` polls for it. The model is then unfitted.

`TimeoutError`

If a fit that `fit()` polls for has not completed
within `TABPFN_CLIENT_ASYNC_POLL_TIMEOUT` seconds. The model is
then pending on the new fit.

***

## `TabPFNRegressor.predict`

[ View source ](https://github.com/PriorLabs/tabpfn-client/blob/ce678cec44dc715f4d835a44990a8f5f115b7acc/src/tabpfn_client/estimator.py#L1461)

Predict regression target for `X`.

Once the server has accepted the prediction, it replaces the model's
pending prediction, as [`submit_predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#submit-predict) does. While `predict()` waits
for a prediction the server runs as a background job, the model holds
it: if the wait stops, for a timeout or an interrupt, the prediction
stays pending, for [`wait_for_predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#wait-for-predict) to resume and [`save_model()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/model-selection-and-persistence#save-model) to
save. A `"full"` output split over several requests is not held: if the
wait for it stops, the client logs the ids of the predictions still
running.

```python theme={null}
TabPFNRegressor.predict(
    X: pd.DataFrame | np.ndarray,
    output_type: RegressorOutputLiteral = "mean",
    quantiles: list[float] | None = None,
) -> np.ndarray | list[np.ndarray] | dict[str, np.ndarray]
```

> [accordion] Type aliases
>
> ```python theme={null}
> RegressorOutputLiteral = Literal["mean", "median", "mode", "quantiles", "full", "main"]
> ```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X` | `pd.DataFrame \| np.ndarray` | Required | The input data, of shape (n\_samples, n\_features). |
| `output_type` | `RegressorOutputLiteral` | `"mean"` | Determines the type of output to return. - If `"mean"`, we return the mean over the predicted distribution. - If `"median"`, we return the median over the predicted   distribution. - If `"mode"`, we return the mode over the predicted distribution. - If `"quantiles"`, we return the quantiles of the predicted   distribution. The parameter `quantiles` determines which   quantiles are returned. - If `"main"`, we return all the output types above in a dict. - If `"full"`, we return the full output of the model, including   the logits, the borders and all the output types from "main".   The criterion is included when the optional `tabpfn` and   `torch` packages are installed. A full output too large for   one response is split over several requests; those that run   as background jobs overlap, up to 4 at once. |
| `quantiles` | `list[float] \| None` | `None` | The quantiles to return if `output_type="quantiles"`. By default, the `[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]` quantiles are returned. |

**Returns**

| Type | Description |
| - | - |
| `np.ndarray \| list[np.ndarray] \| dict[str, np.ndarray]` | An array of predictions for `"mean"`, `"median"` and `"mode"`; a list with one array per quantile for `"quantiles"`; a dict of arrays for `"main"` and `"full"`. |

**Raises**

`NotFittedError`

If the model has no fit, or its fit is pending:
call [`wait_for_fit()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#wait-for-fit) first.

`ValueError`

If `output_type` is not one of the above, `X` exceeds
the model limits or the group columns are invalid.

`RuntimeError`

If a `"full"` prediction split across several requests
returns fields that cannot be combined.

[`PredictFailedError`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/exceptions#predictfailederror)

If the server reports that the prediction
failed, in answer to the prediction request or to a poll for it.
Another failed request raises RuntimeError, which
[`PredictFailedError`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/exceptions#predictfailederror) subclasses.

[`RefitRequiredError`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/exceptions#refitrequirederror)

If the fitted model can no longer predict:
call [`fit()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#fit) again.

`TimeoutError`

If a prediction the server runs as a background job
has not completed within `TABPFN_CLIENT_ASYNC_POLL_TIMEOUT`
seconds. The model then holds it: call [`wait_for_predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#wait-for-predict).

***

## `TabPFNRegressor.get_timings`

[ View source ](https://github.com/PriorLabs/tabpfn-client/blob/ce678cec44dc715f4d835a44990a8f5f115b7acc/src/tabpfn_client/estimator.py#L148)

Seconds the server spent on the last fit and the last prediction.

Returns `{"fit": ..., "predict": ...}`:

* [`fit`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#fit): `elapsed_s`, `queue_wait_s`, `train_set_transform_s`,
  `fit_s`.
* [`predict`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#predict): `test_set_transform_queue_wait_s`,
  `test_set_transform_s`, `predict_queue_wait_s`, `predict_s`.
  A prediction sent in several requests reports their sum.

Queue wait is time spent waiting for the server to start the work. An
entry is `None` before the first call, while a fit is pending, on a model
restored with [`load_model()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/model-selection-and-persistence#load-model) from a completed fit, and when the server
does not report timings.

```python theme={null}
TabPFNRegressor.get_timings() -> dict[str, dict[str, Any] | None]
```

**Returns**

| Type | Description |
| - | - |
| `dict[str, dict[str, Any] \| None]` | — |

***

## `TabPFNRegressor.last_predict_timings`

[ View source ](https://github.com/PriorLabs/tabpfn-client/blob/ce678cec44dc715f4d835a44990a8f5f115b7acc/src/tabpfn_client/estimator.py#L144)

Seconds per stage of the most recent prediction, or `None`.

**Returns**

| Type | Description |
| - | - |
| `dict[str, Any] \| None` | — |

***

## `TabPFNRegressor.submit_fit`

[ View source ](https://github.com/PriorLabs/tabpfn-client/blob/ce678cec44dc715f4d835a44990a8f5f115b7acc/src/tabpfn_client/estimator.py#L208)

Start fitting the model on the server, without waiting for the fit.

Checks and uploads the training data as [`fit()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#fit) does, but returns as
soon as the server has accepted the fit, which it then runs as a
background job, whatever `api_mode` is. Until [`wait_for_fit()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#wait-for-fit) sees
the fit complete, the model is pending: [`predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#predict) raises
`NotFittedError`, and [`save_model()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/model-selection-and-persistence#save-model) saves it as a pending fit, which
a later run can [`load_model()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/model-selection-and-persistence#load-model) and wait for. The id of the fit is in
`model_id_` as soon as `submit_fit()` returns, for logs or support
requests.

```python theme={null}
TabPFNRegressor.submit_fit(
    X: pd.DataFrame | np.ndarray,
    y: pd.Series | np.ndarray,
    description: str | None = None,
) -> Self
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X` | `pd.DataFrame \| np.ndarray` | Required | The input data. |
| `y` | `pd.Series \| np.ndarray` | Required | The target variable. |
| `description` | `str \| None` | `None` | Description of the dataset and task for the server. |

**Returns**

| Type | Description |
| - | - |
| `Self` | self |

**Raises**

`ValueError`

If the data or the estimator's parameters are invalid,
or the data exceeds the model limits.

***

## `TabPFNRegressor.wait_for_fit`

[ View source ](https://github.com/PriorLabs/tabpfn-client/blob/ce678cec44dc715f4d835a44990a8f5f115b7acc/src/tabpfn_client/estimator.py#L239)

Wait for the server to complete the fit [`submit_fit()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#submit-fit) started.

Polls the server until the fit has completed, after which the model
can predict. A model [`load_model()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/model-selection-and-persistence#load-model) restored from a record of a pending
fit is waited for the same way. Returns at once, without a request, if
the fit has already completed.

```python theme={null}
TabPFNRegressor.wait_for_fit() -> Self
```

**Returns**

| Type | Description |
| - | - |
| `Self` | self |

**Raises**

`NotFittedError`

If the model has no fit to wait for.

[`FitFailedError`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/exceptions#fitfailederror)

If the server reports that the fit failed. The
model is then unfitted.

[`FittedModelNotFoundError`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/exceptions#fittedmodelnotfounderror)

If the server does not have the fit, for
instance because it was deleted. The model is then unfitted.

`TimeoutError`

If the fit has not completed within
`TABPFN_CLIENT_ASYNC_POLL_TIMEOUT` seconds. The model is still
pending, so `wait_for_fit()` can be called again.

`RuntimeError`

If polling for the fit fails 4 times in a row with
an unexpected error. The model is still pending.

***

## `TabPFNRegressor.submit_predict`

[ View source ](https://github.com/PriorLabs/tabpfn-client/blob/ce678cec44dc715f4d835a44990a8f5f115b7acc/src/tabpfn_client/estimator.py#L1571)

Start predicting on the server, without waiting for the predictions.

Checks and uploads `X` as [`predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#predict) does, but returns as soon as the
server has accepted the prediction, which it then runs as a background
job, whatever `api_mode` is. [`wait_for_predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#wait-for-predict) waits for it and
returns the predictions. The model holds one pending prediction: a new
`submit_predict()` or [`predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#predict) replaces it once the server has
accepted the new prediction, and a new fit drops it. [`save_model()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/model-selection-and-persistence#save-model)
saves it, and a pickled or copied model keeps it; `clone()` does not.

```python theme={null}
TabPFNRegressor.submit_predict(
    X: pd.DataFrame | np.ndarray,
    output_type: RegressorOutputLiteral = "mean",
    quantiles: list[float] | None = None,
) -> Self
```

> [accordion] Type aliases
>
> ```python theme={null}
> RegressorOutputLiteral = Literal["mean", "median", "mode", "quantiles", "full", "main"]
> ```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X` | `pd.DataFrame \| np.ndarray` | Required | The input data, of shape (n\_samples, n\_features). |
| `output_type` | `RegressorOutputLiteral` | `"mean"` | The type of output to return, as for [`predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#predict). A `"full"` output must fit in one response; [`predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#predict) splits a larger one over several requests. |
| `quantiles` | `list[float] \| None` | `None` | The quantiles to return if `output_type="quantiles"`, as for [`predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#predict). |

**Returns**

| Type | Description |
| - | - |
| `Self` | self |

**Raises**

`NotFittedError`

If the model has no fit, or its fit is pending:
call [`wait_for_fit()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#wait-for-fit) first.

`ValueError`

If `output_type` is not one [`predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#predict) takes, `X`
exceeds the model limits, the group columns are invalid, or a
`"full"` output for `X` does not fit in one response.

`RuntimeError`

If the server does not run predictions as background
jobs.

[`PredictFailedError`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/exceptions#predictfailederror)

If the server reports that the prediction
failed at once, for example because it could not queue it.

***

## `TabPFNRegressor.wait_for_predict`

[ View source ](https://github.com/PriorLabs/tabpfn-client/blob/ce678cec44dc715f4d835a44990a8f5f115b7acc/src/tabpfn_client/estimator.py#L1624)

Wait for the pending prediction, and return it.

The pending prediction is the one [`submit_predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#submit-predict) started, or one
[`predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#predict) stopped waiting for. Polls the server until the prediction
has completed. Until then the prediction is pending, so a wait that
stops can be resumed by calling `wait_for_predict()` again.

```python theme={null}
TabPFNRegressor.wait_for_predict() -> np.ndarray | list[np.ndarray] | dict[str, np.ndarray]
```

**Returns**

| Type | Description |
| - | - |
| `np.ndarray \| list[np.ndarray] \| dict[str, np.ndarray]` | The predictions, as [`predict()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#predict) returns them for the `output_type` and `quantiles` the prediction was started with. |

**Raises**

`RuntimeError`

If no prediction is pending, polling for it fails,
or the server no longer has it. In the last case, it is then
no longer pending.

[`PredictFailedError`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/exceptions#predictfailederror)

If the server reports that the prediction
failed. It is then no longer pending.

[`RefitRequiredError`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/exceptions#refitrequirederror)

If the fitted model can no longer predict:
call [`fit()`](https://docs.priorlabs.ai/api-reference/python/tabpfn-client/regressor/fitting-and-prediction#fit) again. The prediction is then no longer pending.

`TimeoutError`

If the prediction has not completed within
`TABPFN_CLIENT_ASYNC_POLL_TIMEOUT` seconds.

## Scikit-learn scoring

Inherited [`score(X, y, sample_weight=None)`](https://scikit-learn.org/stable/modules/generated/sklearn.base.RegressorMixin.html#sklearn.base.RegressorMixin.score) calls `predict` and returns the coefficient of determination (`R²`).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.