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

<div className="python-reference-heading">
  <h2 id="survival-survival-survivaltabpfn">
    `SurvivalTabPFN`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/survival/survival.py#L35" aria-label="View source for SurvivalTabPFN"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

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`](/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`](/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`](/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`](/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**

<div className="python-reference-table">
  | Parameter | Type | Default | Description |
  | - | - | - | - |
  | <span id="survival-survival-survivaltabpfn--cls-model" /><code className="python-reference-parameter">cls\_<wbr />model</code> | <code className="python-reference-type">Tab<wbr />PFN<wbr />Classifier \| None</code> | `None` | If `None`, created in fit with `random_state`. |
  | <span id="survival-survival-survivaltabpfn--reg-model" /><code className="python-reference-parameter">reg\_<wbr />model</code> | <code className="python-reference-type">Tab<wbr />PFN<wbr />Regressor \| None</code> | `None` | If `None`, created in fit with `random_state`. |
  | <span id="survival-survival-survivaltabpfn--risk-strategy" /><code className="python-reference-parameter">risk\_<wbr />strategy</code> | <code className="python-reference-type">Literal\["weighted\_cdf", "avg\_cdf", "p\_over\_mean"]</code> | `"weighted_cdf"` | — |
  | <span id="survival-survival-survivaltabpfn--default-horizons" /><code className="python-reference-parameter">default\_<wbr />horizons</code> | <code className="python-reference-type">Iterable\[float] \| None</code> | `None` | — |
  | <span id="survival-survival-survivaltabpfn--n-auto-horizons" /><code className="python-reference-parameter">n\_<wbr />auto\_<wbr />horizons</code> | <code className="python-reference-type">int</code> | `6` | — |
  | <span id="survival-survival-survivaltabpfn--auto-horizon-quantile-range" /><code className="python-reference-parameter">auto\_<wbr />horizon\_<wbr />quantile\_<wbr />range</code> | <code className="python-reference-type">tuple\[float, float]</code> | `(0.1, 0.9)` | — |
  | <span id="survival-survival-survivaltabpfn--exp-weight-gamma" /><code className="python-reference-parameter">exp\_<wbr />weight\_<wbr />gamma</code> | <code className="python-reference-type">float</code> | `0.85` | — |
  | <span id="survival-survival-survivaltabpfn--eps" /><code className="python-reference-parameter">eps</code> | <code className="python-reference-type">float</code> | `1e-09` | — |
  | <span id="survival-survival-survivaltabpfn--random-state" /><code className="python-reference-parameter">random\_<wbr />state</code> | <code className="python-reference-type">any</code> | `None` | — |
</div>

***

<div className="python-reference-heading">
  <h2 id="survival-survival-survivaltabpfn-fit">
    `SurvivalTabPFN.fit`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/survival/survival.py#L115" aria-label="View source for SurvivalTabPFN.fit"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

***

<div className="python-reference-heading">
  <h2 id="survival-survival-survivaltabpfn-predict">
    `SurvivalTabPFN.predict`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/survival/survival.py#L279" aria-label="View source for SurvivalTabPFN.predict"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

***

<div className="python-reference-heading">
  <h2 id="survival-survival-survivaltabpfn-predict-cif-at">
    `SurvivalTabPFN.predict_cif_at`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/survival/survival.py#L158" aria-label="View source for SurvivalTabPFN.predict_cif_at"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

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**

<div className="python-reference-table">
  | Parameter | Type | Default | Description |
  | - | - | - | - |
  | <span id="survival-survival-survivaltabpfn-predict-cif-at--x" /><code className="python-reference-parameter">X</code> | <code className="python-reference-type"><a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html">np.ndarray</a></code> | Required | — |
  | <span id="survival-survival-survivaltabpfn-predict-cif-at--t-grid" /><code className="python-reference-parameter">t\_<wbr />grid</code> | <code className="python-reference-type">Iterable\[float]</code> | Required | — |
</div>

**Returns**

<div className="python-reference-table python-reference-returns">
  | Type | Description |
  | - | - |
  | <code className="python-reference-type"><a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html">np.ndarray</a></code> | — |
</div>

***

<div className="python-reference-heading">
  <h2 id="survival-survival-survivaltabpfn-predict-risk">
    `SurvivalTabPFN.predict_risk`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/survival/survival.py#L235" aria-label="View source for SurvivalTabPFN.predict_risk"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

***

<div className="python-reference-heading">
  <h2 id="survival-survival-survivaltabpfn-predict-survival-from-cif-at">
    `SurvivalTabPFN.predict_survival_from_cif_at`
  </h2>

  <a className="python-reference-source" href="https://github.com/PriorLabs/tabpfn-extensions/blob/840c15a1848a986b39c85bc17efc61e0e377f983/src/tabpfn_extensions/survival/survival.py#L199" aria-label="View source for SurvivalTabPFN.predict_survival_from_cif_at"><span aria-hidden="true">\</></span> View source <span aria-hidden="true">↗</span></a>
</div>

Complement 1 - CIF\_1(t|`X`) based on [`predict_cif_at`](/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**

<div className="python-reference-table">
  | Parameter | Type | Default | Description |
  | - | - | - | - |
  | <span id="survival-survival-survivaltabpfn-predict-survival-from-cif-at--x" /><code className="python-reference-parameter">X</code> | <code className="python-reference-type"><a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html">np.ndarray</a></code> | Required | — |
  | <span id="survival-survival-survivaltabpfn-predict-survival-from-cif-at--t-grid" /><code className="python-reference-parameter">t\_<wbr />grid</code> | <code className="python-reference-type">Iterable\[float]</code> | Required | — |
</div>

**Returns**

<div className="python-reference-table python-reference-returns">
  | Type | Description |
  | - | - |
  | <code className="python-reference-type"><a href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html">np.ndarray</a></code> | 1 - CIF\_1(t\|`X`) = 1 - P(T \<= t, event=1 \| `X`), |
</div>


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