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

# Survival analysis

> Two-head TabPFN survival scorer:   1) classifier -> P(event | X)   2) distributional regressor -> T | (event, X)

## Installation

```bash theme={null}
pip install "tabpfn-extensions[survival]" scikit-survival
```

## `SurvivalTabPFN`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/survival/survival.py#L35)

Two-head TabPFN survival scorer:

1. classifier -> P(event | X)
2. distributional regressor -> T | (event, X)

Scalar risk options (higher = riskier):

* "weighted\_cdf" (default): sum\_j w\_j \* CIF\_1(tau\_j | X),
  where CIF\_1(t | X) = P(T \<= t, event=1 | X).
* "avg\_cdf": uniform average of CIF\_1(tau\_j | X) across horizons.
* "p\_over\_mean": P(event|X) / E\[T | event, X]  (legacy fallback).

Also exposes CIF-based curves for event=1:

* [`predict_cif_at`](https://docs.priorlabs.ai/api-reference/python/tabpfn-extensions/survival#survival-survival-survivaltabpfn-predict-cif-at)(X, t\_grid)
  -> CIF\_1(t|X) = P(T \<= t, event=1 | X)
* [`predict_survival_from_cif_at`](https://docs.priorlabs.ai/api-reference/python/tabpfn-extensions/survival#survival-survival-survivaltabpfn-predict-survival-from-cif-at)(X, t\_grid)
  -> 1 - CIF\_1(t|X)

Backwards-compatible aliases (deprecated):

* predict\_cdf\_at(X, t\_grid)
  -> same as [`predict_cif_at`](https://docs.priorlabs.ai/api-reference/python/tabpfn-extensions/survival#survival-survival-survivaltabpfn-predict-cif-at), returns CIF\_1(t|X)
* predict\_survival\_at(X, t\_grid)
  -> same as [`predict_survival_from_cif_at`](https://docs.priorlabs.ai/api-reference/python/tabpfn-extensions/survival#survival-survival-survivaltabpfn-predict-survival-from-cif-at)

```python theme={null}
SurvivalTabPFN(
    *,
    cls_model: TabPFNClassifier | None = None,
    reg_model: TabPFNRegressor | None = None,
    risk_strategy: Literal["weighted_cdf", "avg_cdf", "p_over_mean"] = "weighted_cdf",
    default_horizons: Iterable[float] | None = None,
    n_auto_horizons: int = 6,
    auto_horizon_quantile_range: tuple[float, float] = (0.1, 0.9),
    exp_weight_gamma: float = 0.85,
    eps: float = 1e-09,
    random_state = None,
)
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `cls_model` | `TabPFNClassifier \| None` | `None` | If `None`, created in fit with `random_state`. |
| `reg_model` | `TabPFNRegressor \| None` | `None` | If `None`, created in fit with `random_state`. |
| `risk_strategy` | `Literal["weighted_cdf", "avg_cdf", "p_over_mean"]` | `"weighted_cdf"` | — |
| `default_horizons` | `Iterable[float] \| None` | `None` | — |
| `n_auto_horizons` | `int` | `6` | — |
| `auto_horizon_quantile_range` | `tuple[float, float]` | `(0.1, 0.9)` | — |
| `exp_weight_gamma` | `float` | `0.85` | — |
| `eps` | `float` | `1e-09` | — |
| `random_state` | `any` | `None` | — |

***

## `SurvivalTabPFN.fit`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/survival/survival.py#L115)

***

## `SurvivalTabPFN.predict`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/survival/survival.py#L279)

***

## `SurvivalTabPFN.predict_cif_at`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/survival/survival.py#L158)

Event-1 cumulative incidence CIF\_1(t|`X`).

Computes

CIF\_1(t|`X`) = P(T \<= t, event=1 | `X`)

via the factorization

P(event=1 | `X`) \* P(T \<= t | event=1, `X`).

```python theme={null}
SurvivalTabPFN.predict_cif_at(
    X: np.ndarray,
    t_grid: Iterable[float],
) -> np.ndarray
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X` | `np.ndarray` | Required | — |
| `t_grid` | `Iterable[float]` | Required | — |

**Returns**

| Type | Description |
| - | - |
| `np.ndarray` | — |

***

## `SurvivalTabPFN.predict_risk`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/survival/survival.py#L235)

***

## `SurvivalTabPFN.predict_survival_from_cif_at`

[ View source ](https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/survival/survival.py#L199)

Complement 1 - CIF\_1(t|`X`) based on [`predict_cif_at`](https://docs.priorlabs.ai/api-reference/python/tabpfn-extensions/survival#survival-survival-survivaltabpfn-predict-cif-at).

i.e. the probability that event 1 has not yet occurred by time `t`.

```python theme={null}
SurvivalTabPFN.predict_survival_from_cif_at(
    X: np.ndarray,
    t_grid: Iterable[float],
) -> np.ndarray
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `X` | `np.ndarray` | Required | — |
| `t_grid` | `Iterable[float]` | Required | — |

**Returns**

| Type | Description |
| - | - |
| `np.ndarray` | 1 - CIF\_1(t\|`X`) = 1 - P(T \<= t, event=1 \| `X`), |


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