Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion capabilities/classification.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ 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
# To use TabPFNv2:
# from tabpfn.constants import ModelVersion
Comment on lines +17 to +18
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It is generally recommended to use the public API for imports rather than internal sub-modules like constants. In TabPFN v2.x, ModelVersion is exported directly at the package level, so you can import it from tabpfn instead of tabpfn.constants.

Additionally, ensure that when users uncomment this, they also update the model initialization to include the desired device (e.g., device="cuda"), as the create_default_for_version method might otherwise default to CPU.

# To use TabPFNv2:
# from tabpfn import ModelVersion


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)
Expand Down Expand Up @@ -44,4 +46,4 @@ print("Log-Loss:", log_loss(y_test, probs))
<Card title="Metric Tuning" icon="puzzle" href="/capabilities/metric-tuning">
Tune scores other than maximum probability prediction such as F1 or balanced accuracy.
</Card>
</CardGroup>
</CardGroup>