Skip to main content
TabPFN provides a comprehensive interface for handling classification tasks on tabular data. The TabPFNClassifier class can be used for binary and multi-class classification problems.

Getting Started

The following shows a full example of using the TabPFNClassifier:
from tabpfn import TabPFNClassifier
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, log_loss

X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

model = TabPFNClassifier(device="cuda")
# To use TabPFNv2:
# model = TabPFNClassifier.create_default_for_version(ModelVersion.V2)
model.fit(X_train, y_train)

# Predict class labels
preds = model.predict(X_test)
print("Accuracy:", accuracy_score(y_test, preds))

# Predict class probabilities
probs = model.predict_proba(X_test)
print("Log-Loss:", log_loss(y_test, probs))

Many Class Classifier

Scalable classification for hundreds of classes with TabPFN.

AutoTabPFN Ensembles

Automated ensembling of TabPFN models for the best accuracy.

Metric Tuning

Tune scores other than maximum probability prediction such as F1 or balanced accuracy.