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

# Scoring

> Scoring

## Installation

```bash theme={null}
pip install tabpfn-extensions
```

## `safe_roc_auc_score`

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

Compute the Area Under the Receiver Operating Characteristic Curve (ROC AUC) score.

This function is a safe wrapper around `sklearn.metrics.roc_auc_score` that handles
cases where the input data may have missing classes or binary classification problems.

```python theme={null}
safe_roc_auc_score(
    y_true,
    y_score,
    **kwargs,
)
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `y_true` | `array-like of shape (n_samples,)` | Required | `True` binary labels or binary label indicators. |
| `y_score` | `array-like of shape (n_samples,) or (n_samples, n_classes)` | Required | Target scores, can either be probability estimates of the positive class, confidence values, or non-thresholded measure of decisions. |
| `**kwargs` | `dict` | — | Additional keyword arguments to pass to `sklearn.metrics.roc_auc_score`. |

**Returns**

| Type | Description |
| - | - |
| — | `float`: The ROC AUC score. |

**Raises**

`ValueError`

If there are missing classes in `y_true` that cannot be handled.

***

## `score_classification`

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

General function to score classification predictions.

```python theme={null}
score_classification(
    optimize_metric: Literal["roc", "auroc", "accuracy", "f1", "log_loss"],
    y_true,
    y_pred,
    sample_weight = None,
    *,
    y_pred_is_labels: bool = False,
)
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `optimize_metric` | `Literal["roc", "auroc", "accuracy", "f1", "log_loss"]` | Required | The metric to use for scoring the predictions. |
| `y_true` | `array-like of shape (n_samples,)` | Required | `True` labels or binary label indicators. |
| `y_pred` | `array-like of shape (n_samples,) or (n_samples, n_classes)` | Required | Predicted labels, probabilities, or confidence values. |
| `sample_weight` | `array-like of shape (n_samples,), default=None` | `None` | Sample weights. |
| `y_pred_is_labels` | `bool` | `False` | — |

**Returns**

| Type | Description |
| - | - |
| — | `float`: The score for the specified metric. |

**Raises**

`ValueError`

If an unknown metric is specified.

***

## `score_regression`

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

General function to score regression predictions.

```python theme={null}
score_regression(
    optimize_metric: Literal["rmse", "mse", "mae", "r2"],
    y_true,
    y_pred,
    sample_weight = None,
)
```

**Parameters**

| Parameter | Type | Default | Description |
| - | - | - | - |
| `optimize_metric` | `Literal["rmse", "mse", "mae", "r2"]` | Required | The metric to use for scoring the predictions. |
| `y_true` | `array-like of shape (n_samples,)` | Required | `True` target values. |
| `y_pred` | `array-like of shape (n_samples,)` | Required | Predicted target values. |
| `sample_weight` | `array-like of shape (n_samples,), default=None` | `None` | Sample weights. |

**Returns**

| Type | Description |
| - | - |
| — | `float`: The score for the specified metric. |

**Raises**

`ValueError`

If an unknown metric is specified.


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