TabPFN is a foundation model for tabular data that outperforms traditional methods while being dramatically faster. This package provides easy access to the TabPFN API from R, enabling state-of-the-art tabular machine learning in just a few lines of code.
devtools::install_github("PriorLabs/R-tabpfn")
library(tabpfn)
install_tabpfn()TabPFN is a cloud-based service. You need a free access token to use it.
- Sign up or log in at https://ux.priorlabs.ai/account
- Copy your access token from the account page.
The token is the same credential used by the Python tabpfn-client library.
If you already have a Python token, retrieve it with:
import tabpfn_client
print(tabpfn_client.get_access_token())Keep your token private — treat it like a password.
# Load library, set access token, create classifier
library(tabpfn)
access_token = "YOUR_ACCESS_TOKEN"
set_tabpfn_access_token(access_token)
classifier <- TabPFNClassifier$new()
# Prepare your data (here random example data)
X <- data.frame(feature1 = rnorm(100), feature2 = rnorm(100))
num_classes <- 3
y <- sample(0:(num_classes-1), 100, replace = TRUE)
X_train = X[1:80,]
y_train = y[1:80]
X_test = X[81:length(X),]
y_test = y[81:length(y)]
# Fit the model
classifier$fit(X_train, y_train)
# Make predictions
predictions <- classifier$predict(X_test)
# Print results
print(predictions)You may also use a regressor like this:
regressor <- TabPFNRegressor$new()
# Fit the model
regressor$fit(X_train, y_train)
# Make predictions
predictions <- regressor$predict(X_test)This is an alpha release. We appreciate your understanding and feedback as we continue to improve the package.
This is a cloud-based service using our TabPFN client (https://github.com/PriorLabs/tabpfn-client). Your data will be sent to our servers for processing.
- Do NOT upload any Personally Identifiable Information (PII)
- Do NOT upload any sensitive or confidential data
- Do NOT upload any data you don't have permission to share
- Consider anonymizing or pseudonymizing your data before upload
- Review your organization's data sharing policies before use