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

# Grouped data

> Keep each customer, patient or store in one fold when it has several rows.

When an entity has several rows, a model trained on some of them recognizes it in the others. Shuffled folds then score better than the model will do on new entities.

## Set it up

Claude looks for a column with repeated values, such as `customer_id`, and reports what it finds ("3 rows per customer on average"). At the **Rows** question, choose **Several rows per `customer_id`**.

Claude writes a copy of your CSV with a `fold` column that puts all rows of one entity in the same fold. It uses scikit-learn's `StratifiedGroupKFold` with 8 folds for classification and `GroupKFold` with 8 folds for regression. Each entity is then scored by a model that never saw it.

To build the copy yourself:

```python theme={null}
import pandas as pd
from sklearn.model_selection import StratifiedGroupKFold

df = pd.read_csv("visits.csv")
df["fold"] = -1
cv = StratifiedGroupKFold(n_splits=8, shuffle=True, random_state=0)
for i, (_, val) in enumerate(cv.split(df, df["readmitted"], groups=df["patient_id"])):
    df.loc[df.index[val], "fold"] = i
df.to_csv("visits_folds.csv", index=False)
```

## Drop or keep the entity column

The entity column is usually an ID. Drop it unless the same entities appear when you predict and their ID carries meaning. Claude asks.

## What to expect

* **All 8 folds, or the first fold only.** One fold is faster and uses fewer TabPFN tokens, but scores are noisier.
* **No repeats.** Your folds are the same every time.
* **Lower scores than shuffled folds.** This is expected. Grouped folds measure how the model does on entities it has not seen.

If the same entity appears in both training and prediction, for example existing customers, shuffled folds can be the right choice. Pick the validation that matches how you will use the model.


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