Name | tabpfn JSON |
Version |
2.1.0
JSON |
| download |
home_page | None |
Summary | TabPFN: Foundation model for tabular data |
upload_time | 2025-07-09 16:29:15 |
maintainer | None |
docs_url | None |
author | Noah Hollmann, Samuel Müller, Lennart Purucker, Arjun Krishnakumar, Max Körfer, Shi Bin Hoo, Robin Tibor Schirrmeister, Frank Hutter, Eddie Bergman, Leo Grinsztajn |
requires_python | >=3.9 |
license |
Prior Labs License
Version 1.1, May 2025
http://priorlabs.ai/tabpfn-license
This license is a derivative of the Apache 2.0 license
(http://www.apache.org/licenses/) with a single modification:
The added Paragraph 10 introduces an enhanced attribution requirement
inspired by the Llama 3 license.
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
---------------------- ADDITIONAL PROVISION --------------------------
10. Additional attribution.
If You distribute or make available the Work or any Derivative
Work thereof relating to any part of the source or model weights,
or a product or service (including another AI model) that contains
any source or model weights, You shall (A) provide a copy of this
License with any such materials; and (B) prominently display
“Built with PriorLabs-TabPFN” on each related website, user interface, blogpost,
about page, or product documentation. If You use the source or model
weights or model outputs to create, train, fine tune, distil, or
otherwise improve an AI model, which is distributed or made available,
you shall also include “TabPFN” at the beginning of any such AI model name.
To clarify, internal benchmarking and testing without external
communication shall not qualify as distribution or making available
pursuant to this Section 10 and no attribution under this Section 10
shall be required.
END OF TERMS AND CONDITIONS
|
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# TabPFN
[](https://badge.fury.io/py/tabpfn)
[](https://pepy.tech/project/tabpfn)
[](https://discord.com/channels/1285598202732482621/)
[](https://priorlabs.ai/docs)
[](https://colab.research.google.com/github/PriorLabs/TabPFN/blob/main/examples/notebooks/TabPFN_Demo_Local.ipynb)
[](https://pypi.org/project/tabpfn/)
<img src="https://github.com/PriorLabs/tabpfn-extensions/blob/main/tabpfn_summary.webp" width="80%" alt="TabPFN Summary">
⚠️ **Major Update: Version 2.0:** Complete codebase overhaul with new architecture and
features. Previous version available at [v1.0.0](../../tree/v1.0.0) and
`pip install tabpfn==0.1.11`.
📚 For detailed usage examples and best practices, check out [Interactive Colab Tutorial](https://colab.research.google.com/github/PriorLabs/TabPFN/blob/main/examples/notebooks/TabPFN_Demo_Local.ipynb)
## 🏁 Quick Start
TabPFN is a foundation model for tabular data that outperforms traditional methods while
being dramatically faster. This repository contains the core PyTorch implementation with
CUDA optimization.
> ⚡ **GPU Recommended**:
> For optimal performance, use a GPU (even older ones with ~8GB VRAM work well; 16GB needed for some large datasets).
> On CPU, only small datasets (≲1000 samples) are feasible.
> No GPU? Use our free hosted inference via [TabPFN Client](https://github.com/PriorLabs/tabpfn-client).
### Installation
Official installation (pip)
```bash
pip install tabpfn
```
OR installation from source
```bash
pip install "tabpfn @ git+https://github.com/PriorLabs/TabPFN.git"
```
OR local development installation
```bash
git clone https://github.com/PriorLabs/TabPFN.git
pip install -e "TabPFN[dev]"
```
### Basic Usage
#### Classification
```python
from sklearn.datasets import load_breast_cancer
from sklearn.metrics import accuracy_score, roc_auc_score
from sklearn.model_selection import train_test_split
from tabpfn import TabPFNClassifier
# Load data
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.5, random_state=42)
# Initialize a classifier
clf = TabPFNClassifier()
clf.fit(X_train, y_train)
# Predict probabilities
prediction_probabilities = clf.predict_proba(X_test)
print("ROC AUC:", roc_auc_score(y_test, prediction_probabilities[:, 1]))
# Predict labels
predictions = clf.predict(X_test)
print("Accuracy", accuracy_score(y_test, predictions))
```
#### Regression
```python
from sklearn.datasets import fetch_openml
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.model_selection import train_test_split
from tabpfn import TabPFNRegressor
# Load Boston Housing data
df = fetch_openml(data_id=531, as_frame=True) # Boston Housing dataset
X = df.data
y = df.target.astype(float) # Ensure target is float for regression
# Train-test split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=42)
# Initialize the regressor
regressor = TabPFNRegressor()
regressor.fit(X_train, y_train)
# Predict on the test set
predictions = regressor.predict(X_test)
# Evaluate the model
mse = mean_squared_error(y_test, predictions)
r2 = r2_score(y_test, predictions)
print("Mean Squared Error (MSE):", mse)
print("R² Score:", r2)
```
### Best Results
For optimal performance, use the `AutoTabPFNClassifier` or `AutoTabPFNRegressor` for post-hoc ensembling. These can be found in the [TabPFN Extensions](https://github.com/PriorLabs/tabpfn-extensions) repository. Post-hoc ensembling combines multiple TabPFN models into an ensemble.
**Steps for Best Results:**
1. Install the extensions:
```bash
git clone https://github.com/priorlabs/tabpfn-extensions.git
pip install -e tabpfn-extensions
```
2.
```python
from tabpfn_extensions.post_hoc_ensembles.sklearn_interface import AutoTabPFNClassifier
clf = AutoTabPFNClassifier(max_time=120, device="cuda") # 120 seconds tuning time
clf.fit(X_train, y_train)
predictions = clf.predict(X_test)
```
## 🌐 TabPFN Ecosystem
Choose the right TabPFN implementation for your needs:
- **[TabPFN Client](https://github.com/priorlabs/tabpfn-client)**
Simple API client for using TabPFN via cloud-based inference.
- **[TabPFN Extensions](https://github.com/priorlabs/tabpfn-extensions)**
A powerful companion repository packed with advanced utilities, integrations, and features - great place to contribute:
- 🔍 **`interpretability`**: Gain insights with SHAP-based explanations, feature importance, and selection tools.
- 🕵️♂️ **`unsupervised`**: Tools for outlier detection and synthetic tabular data generation.
- 🧬 **`embeddings`**: Extract and use TabPFN’s internal learned embeddings for downstream tasks or analysis.
- 🧠 **`many_class`**: Handle multi-class classification problems that exceed TabPFN's built-in class limit.
- 🌲 **`rf_pfn`**: Combine TabPFN with traditional models like Random Forests for hybrid approaches.
- ⚙️ **`hpo`**: Automated hyperparameter optimization tailored to TabPFN.
- 🔁 **`post_hoc_ensembles`**: Boost performance by ensembling multiple TabPFN models post-training.
✨ To install:
```bash
git clone https://github.com/priorlabs/tabpfn-extensions.git
pip install -e tabpfn-extensions
```
- **[TabPFN (this repo)](https://github.com/priorlabs/tabpfn)**
Core implementation for fast and local inference with PyTorch and CUDA support.
- **[TabPFN UX](https://ux.priorlabs.ai)**
No-code graphical interface to explore TabPFN capabilities—ideal for business users and prototyping.
## 📜 License
Prior Labs License (Apache 2.0 with additional attribution requirement): [here](https://priorlabs.ai/tabpfn-license/)
## 🤝 Join Our Community
We're building the future of tabular machine learning and would love your involvement:
1. **Connect & Learn**:
- Join our [Discord Community](https://discord.gg/VJRuU3bSxt)
- Read our [Documentation](https://priorlabs.ai/docs)
- Check out [GitHub Issues](https://github.com/priorlabs/tabpfn/issues)
2. **Contribute**:
- Report bugs or request features
- Submit pull requests
- Share your research and use cases
3. **Stay Updated**: Star the repo and join Discord for the latest updates
## 📚 Citation
You can read our paper explaining TabPFN [here](https://doi.org/10.1038/s41586-024-08328-6).
```bibtex
@article{hollmann2025tabpfn,
title={Accurate predictions on small data with a tabular foundation model},
author={Hollmann, Noah and M{\"u}ller, Samuel and Purucker, Lennart and
Krishnakumar, Arjun and K{\"o}rfer, Max and Hoo, Shi Bin and
Schirrmeister, Robin Tibor and Hutter, Frank},
journal={Nature},
year={2025},
month={01},
day={09},
doi={10.1038/s41586-024-08328-6},
publisher={Springer Nature},
url={https://www.nature.com/articles/s41586-024-08328-6},
}
@inproceedings{hollmann2023tabpfn,
title={TabPFN: A transformer that solves small tabular classification problems in a second},
author={Hollmann, Noah and M{\"u}ller, Samuel and Eggensperger, Katharina and Hutter, Frank},
booktitle={International Conference on Learning Representations 2023},
year={2023}
}
```
## ❓ FAQ
### **Usage & Compatibility**
**Q: What dataset sizes work best with TabPFN?**
A: TabPFN is optimized for **datasets up to 10,000 rows**. For larger datasets, consider using **Random Forest preprocessing** or other extensions. See our [Colab notebook](https://colab.research.google.com/drive/154SoIzNW1LHBWyrxNwmBqtFAr1uZRZ6a#scrollTo=OwaXfEIWlhC8) for strategies.
**Q: Why can't I use TabPFN with Python 3.8?**
A: TabPFN v2 requires **Python 3.9+** due to newer language features. Compatible versions: **3.9, 3.10, 3.11, 3.12, 3.13**.
### **Installation & Setup**
**Q: How do I use TabPFN without an internet connection?**
TabPFN automatically downloads model weights when first used. For offline usage:
**Using the Provided Download Script**
If you have the TabPFN repository, you can use the included script to download all models (including ensemble variants):
```bash
# After installing TabPFN
python scripts/download_all_models.py
```
This script will download the main classifier and regressor models, as well as all ensemble variant models to your system's default cache directory.
**Manual Download**
1. Download the model files manually from HuggingFace:
- Classifier: [tabpfn-v2-classifier.ckpt](https://huggingface.co/Prior-Labs/TabPFN-v2-clf/resolve/main/tabpfn-v2-classifier.ckpt)
- Regressor: [tabpfn-v2-regressor.ckpt](https://huggingface.co/Prior-Labs/TabPFN-v2-reg/resolve/main/tabpfn-v2-regressor.ckpt)
2. Place the file in one of these locations:
- Specify directly: `TabPFNClassifier(model_path="/path/to/model.ckpt")`
- Set environment variable: `os.environ["TABPFN_MODEL_CACHE_DIR"] = "/path/to/dir"`
- Default OS cache directory:
- Windows: `%APPDATA%\tabpfn\`
- macOS: `~/Library/Caches/tabpfn/`
- Linux: `~/.cache/tabpfn/`
**Q: I'm getting a `pickle` error when loading the model. What should I do?**
A: Try the following:
- Download the newest version of tabpfn `pip install tabpfn --upgrade`
- Ensure model files downloaded correctly (re-download if needed)
**Q: How do I save and load a trained TabPFN model?**
A: Use :func:`save_fitted_tabpfn_model` to persist a fitted estimator and reload
it later with :func:`load_fitted_tabpfn_model` (or the corresponding
``load_from_fit_state`` class methods).
```python
from tabpfn import TabPFNRegressor
from tabpfn.model.loading import (
load_fitted_tabpfn_model,
save_fitted_tabpfn_model,
)
# Train the regressor on GPU
reg = TabPFNRegressor(device="cuda")
reg.fit(X_train, y_train)
save_fitted_tabpfn_model(reg, "my_reg.tabpfn_fit")
# Later or on a CPU-only machine
reg_cpu = load_fitted_tabpfn_model("my_reg.tabpfn_fit", device="cpu")
```
To store just the foundation model weights (without a fitted estimator) use
``save_tabpfn_model(reg.model_, "my_tabpfn.ckpt")``. This merely saves a
checkpoint of the pre-trained weights so you can later create and fit a fresh
estimator. Reload the checkpoint with ``load_model_criterion_config``.
### **Performance & Limitations**
**Q: Can TabPFN handle missing values?**
A: **Yes!**
**Q: How can I improve TabPFN’s performance?**
A: Best practices:
- Use **AutoTabPFNClassifier** from [TabPFN Extensions](https://github.com/priorlabs/tabpfn-extensions) for post-hoc ensembling
- Feature engineering: Add domain-specific features to improve model performance
Not effective:
- Adapt feature scaling
- Convert categorical features to numerical values (e.g., one-hot encoding)
## 🛠️ Development
1. Setup environment:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
git clone https://github.com/PriorLabs/TabPFN.git
cd TabPFN
pip install -e ".[dev]"
pre-commit install
```
2. Before committing:
```bash
pre-commit run --all-files
```
3. Run tests:
```bash
pytest tests/
```
---
Built with ❤️ by [Prior Labs](https://priorlabs.ai) - Copyright (c) 2025 Prior Labs GmbH
Raw data
{
"_id": null,
"home_page": null,
"name": "tabpfn",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Noah Hollmann, Samuel M\u00fcller, Lennart Purucker, Arjun Krishnakumar, Max K\u00f6rfer, Shi Bin Hoo, Robin Tibor Schirrmeister, Frank Hutter, Eddie Bergman, Leo Grinsztajn",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/35/3a/a195dab09d94766b16837810ae8064079158193532923b96f22a95ed7024/tabpfn-2.1.0.tar.gz",
"platform": null,
"description": "# TabPFN\n\n[](https://badge.fury.io/py/tabpfn)\n[](https://pepy.tech/project/tabpfn)\n[](https://discord.com/channels/1285598202732482621/)\n[](https://priorlabs.ai/docs)\n[](https://colab.research.google.com/github/PriorLabs/TabPFN/blob/main/examples/notebooks/TabPFN_Demo_Local.ipynb)\n[](https://pypi.org/project/tabpfn/)\n\n<img src=\"https://github.com/PriorLabs/tabpfn-extensions/blob/main/tabpfn_summary.webp\" width=\"80%\" alt=\"TabPFN Summary\">\n\n\u26a0\ufe0f **Major Update: Version 2.0:** Complete codebase overhaul with new architecture and\nfeatures. Previous version available at [v1.0.0](../../tree/v1.0.0) and\n`pip install tabpfn==0.1.11`.\n\n\ud83d\udcda For detailed usage examples and best practices, check out [Interactive Colab Tutorial](https://colab.research.google.com/github/PriorLabs/TabPFN/blob/main/examples/notebooks/TabPFN_Demo_Local.ipynb)\n\n## \ud83c\udfc1 Quick Start\n\nTabPFN is a foundation model for tabular data that outperforms traditional methods while\nbeing dramatically faster. This repository contains the core PyTorch implementation with\nCUDA optimization.\n\n> \u26a1 **GPU Recommended**:\n> For optimal performance, use a GPU (even older ones with ~8GB VRAM work well; 16GB needed for some large datasets).\n> On CPU, only small datasets (\u22721000 samples) are feasible.\n> No GPU? Use our free hosted inference via [TabPFN Client](https://github.com/PriorLabs/tabpfn-client).\n\n### Installation\nOfficial installation (pip)\n```bash\npip install tabpfn\n```\nOR installation from source\n```bash\npip install \"tabpfn @ git+https://github.com/PriorLabs/TabPFN.git\"\n```\nOR local development installation\n```bash\n\ngit clone https://github.com/PriorLabs/TabPFN.git\npip install -e \"TabPFN[dev]\"\n```\n\n### Basic Usage\n\n#### Classification\n```python\nfrom sklearn.datasets import load_breast_cancer\nfrom sklearn.metrics import accuracy_score, roc_auc_score\nfrom sklearn.model_selection import train_test_split\n\nfrom tabpfn import TabPFNClassifier\n\n# Load data\nX, y = load_breast_cancer(return_X_y=True)\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=42)\n\n# Initialize a classifier\nclf = TabPFNClassifier()\nclf.fit(X_train, y_train)\n\n# Predict probabilities\nprediction_probabilities = clf.predict_proba(X_test)\nprint(\"ROC AUC:\", roc_auc_score(y_test, prediction_probabilities[:, 1]))\n\n# Predict labels\npredictions = clf.predict(X_test)\nprint(\"Accuracy\", accuracy_score(y_test, predictions))\n```\n\n#### Regression\n```python\nfrom sklearn.datasets import fetch_openml\nfrom sklearn.metrics import mean_squared_error, r2_score\nfrom sklearn.model_selection import train_test_split\n\nfrom tabpfn import TabPFNRegressor\n\n# Load Boston Housing data\ndf = fetch_openml(data_id=531, as_frame=True) # Boston Housing dataset\nX = df.data\ny = df.target.astype(float) # Ensure target is float for regression\n\n# Train-test split\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=42)\n\n# Initialize the regressor\nregressor = TabPFNRegressor()\nregressor.fit(X_train, y_train)\n\n# Predict on the test set\npredictions = regressor.predict(X_test)\n\n# Evaluate the model\nmse = mean_squared_error(y_test, predictions)\nr2 = r2_score(y_test, predictions)\n\nprint(\"Mean Squared Error (MSE):\", mse)\nprint(\"R\u00b2 Score:\", r2)\n```\n\n### Best Results\n\nFor optimal performance, use the `AutoTabPFNClassifier` or `AutoTabPFNRegressor` for post-hoc ensembling. These can be found in the [TabPFN Extensions](https://github.com/PriorLabs/tabpfn-extensions) repository. Post-hoc ensembling combines multiple TabPFN models into an ensemble.\n\n**Steps for Best Results:**\n1. Install the extensions:\n ```bash\n git clone https://github.com/priorlabs/tabpfn-extensions.git\n pip install -e tabpfn-extensions\n ```\n\n2.\n ```python\n from tabpfn_extensions.post_hoc_ensembles.sklearn_interface import AutoTabPFNClassifier\n\n clf = AutoTabPFNClassifier(max_time=120, device=\"cuda\") # 120 seconds tuning time\n clf.fit(X_train, y_train)\n predictions = clf.predict(X_test)\n ```\n\n## \ud83c\udf10 TabPFN Ecosystem\n\nChoose the right TabPFN implementation for your needs:\n\n- **[TabPFN Client](https://github.com/priorlabs/tabpfn-client)**\n Simple API client for using TabPFN via cloud-based inference.\n\n- **[TabPFN Extensions](https://github.com/priorlabs/tabpfn-extensions)**\n A powerful companion repository packed with advanced utilities, integrations, and features - great place to contribute:\n\n - \ud83d\udd0d **`interpretability`**: Gain insights with SHAP-based explanations, feature importance, and selection tools.\n - \ud83d\udd75\ufe0f\u200d\u2642\ufe0f **`unsupervised`**: Tools for outlier detection and synthetic tabular data generation.\n - \ud83e\uddec **`embeddings`**: Extract and use TabPFN\u2019s internal learned embeddings for downstream tasks or analysis.\n - \ud83e\udde0 **`many_class`**: Handle multi-class classification problems that exceed TabPFN's built-in class limit.\n - \ud83c\udf32 **`rf_pfn`**: Combine TabPFN with traditional models like Random Forests for hybrid approaches.\n - \u2699\ufe0f **`hpo`**: Automated hyperparameter optimization tailored to TabPFN.\n - \ud83d\udd01 **`post_hoc_ensembles`**: Boost performance by ensembling multiple TabPFN models post-training.\n\n \u2728 To install:\n ```bash\n git clone https://github.com/priorlabs/tabpfn-extensions.git\n pip install -e tabpfn-extensions\n ```\n\n- **[TabPFN (this repo)](https://github.com/priorlabs/tabpfn)**\n Core implementation for fast and local inference with PyTorch and CUDA support.\n\n- **[TabPFN UX](https://ux.priorlabs.ai)**\n No-code graphical interface to explore TabPFN capabilities\u2014ideal for business users and prototyping.\n\n## \ud83d\udcdc License\n\nPrior Labs License (Apache 2.0 with additional attribution requirement): [here](https://priorlabs.ai/tabpfn-license/)\n\n## \ud83e\udd1d Join Our Community\n\nWe're building the future of tabular machine learning and would love your involvement:\n\n1. **Connect & Learn**:\n - Join our [Discord Community](https://discord.gg/VJRuU3bSxt)\n - Read our [Documentation](https://priorlabs.ai/docs)\n - Check out [GitHub Issues](https://github.com/priorlabs/tabpfn/issues)\n\n2. **Contribute**:\n - Report bugs or request features\n - Submit pull requests\n - Share your research and use cases\n\n3. **Stay Updated**: Star the repo and join Discord for the latest updates\n\n## \ud83d\udcda Citation\n\nYou can read our paper explaining TabPFN [here](https://doi.org/10.1038/s41586-024-08328-6).\n\n```bibtex\n@article{hollmann2025tabpfn,\n title={Accurate predictions on small data with a tabular foundation model},\n author={Hollmann, Noah and M{\\\"u}ller, Samuel and Purucker, Lennart and\n Krishnakumar, Arjun and K{\\\"o}rfer, Max and Hoo, Shi Bin and\n Schirrmeister, Robin Tibor and Hutter, Frank},\n journal={Nature},\n year={2025},\n month={01},\n day={09},\n doi={10.1038/s41586-024-08328-6},\n publisher={Springer Nature},\n url={https://www.nature.com/articles/s41586-024-08328-6},\n}\n\n@inproceedings{hollmann2023tabpfn,\n title={TabPFN: A transformer that solves small tabular classification problems in a second},\n author={Hollmann, Noah and M{\\\"u}ller, Samuel and Eggensperger, Katharina and Hutter, Frank},\n booktitle={International Conference on Learning Representations 2023},\n year={2023}\n}\n```\n\n\n\n## \u2753 FAQ\n\n### **Usage & Compatibility**\n\n**Q: What dataset sizes work best with TabPFN?**\nA: TabPFN is optimized for **datasets up to 10,000 rows**. For larger datasets, consider using **Random Forest preprocessing** or other extensions. See our [Colab notebook](https://colab.research.google.com/drive/154SoIzNW1LHBWyrxNwmBqtFAr1uZRZ6a#scrollTo=OwaXfEIWlhC8) for strategies.\n\n**Q: Why can't I use TabPFN with Python 3.8?**\nA: TabPFN v2 requires **Python 3.9+** due to newer language features. Compatible versions: **3.9, 3.10, 3.11, 3.12, 3.13**.\n\n### **Installation & Setup**\n\n**Q: How do I use TabPFN without an internet connection?**\n\nTabPFN automatically downloads model weights when first used. For offline usage:\n\n**Using the Provided Download Script**\n\nIf you have the TabPFN repository, you can use the included script to download all models (including ensemble variants):\n\n```bash\n# After installing TabPFN\npython scripts/download_all_models.py\n```\n\nThis script will download the main classifier and regressor models, as well as all ensemble variant models to your system's default cache directory.\n\n**Manual Download**\n\n1. Download the model files manually from HuggingFace:\n - Classifier: [tabpfn-v2-classifier.ckpt](https://huggingface.co/Prior-Labs/TabPFN-v2-clf/resolve/main/tabpfn-v2-classifier.ckpt)\n - Regressor: [tabpfn-v2-regressor.ckpt](https://huggingface.co/Prior-Labs/TabPFN-v2-reg/resolve/main/tabpfn-v2-regressor.ckpt)\n\n2. Place the file in one of these locations:\n - Specify directly: `TabPFNClassifier(model_path=\"/path/to/model.ckpt\")`\n - Set environment variable: `os.environ[\"TABPFN_MODEL_CACHE_DIR\"] = \"/path/to/dir\"`\n - Default OS cache directory:\n - Windows: `%APPDATA%\\tabpfn\\`\n - macOS: `~/Library/Caches/tabpfn/`\n - Linux: `~/.cache/tabpfn/`\n\n**Q: I'm getting a `pickle` error when loading the model. What should I do?**\nA: Try the following:\n- Download the newest version of tabpfn `pip install tabpfn --upgrade`\n- Ensure model files downloaded correctly (re-download if needed)\n\n**Q: How do I save and load a trained TabPFN model?**\nA: Use :func:`save_fitted_tabpfn_model` to persist a fitted estimator and reload\nit later with :func:`load_fitted_tabpfn_model` (or the corresponding\n``load_from_fit_state`` class methods).\n\n```python\nfrom tabpfn import TabPFNRegressor\nfrom tabpfn.model.loading import (\n load_fitted_tabpfn_model,\n save_fitted_tabpfn_model,\n)\n\n# Train the regressor on GPU\nreg = TabPFNRegressor(device=\"cuda\")\nreg.fit(X_train, y_train)\nsave_fitted_tabpfn_model(reg, \"my_reg.tabpfn_fit\")\n\n# Later or on a CPU-only machine\nreg_cpu = load_fitted_tabpfn_model(\"my_reg.tabpfn_fit\", device=\"cpu\")\n```\n\nTo store just the foundation model weights (without a fitted estimator) use\n``save_tabpfn_model(reg.model_, \"my_tabpfn.ckpt\")``. This merely saves a\ncheckpoint of the pre-trained weights so you can later create and fit a fresh\nestimator. Reload the checkpoint with ``load_model_criterion_config``.\n\n### **Performance & Limitations**\n\n**Q: Can TabPFN handle missing values?**\nA: **Yes!**\n\n**Q: How can I improve TabPFN\u2019s performance?**\nA: Best practices:\n- Use **AutoTabPFNClassifier** from [TabPFN Extensions](https://github.com/priorlabs/tabpfn-extensions) for post-hoc ensembling\n- Feature engineering: Add domain-specific features to improve model performance\nNot effective:\n - Adapt feature scaling\n - Convert categorical features to numerical values (e.g., one-hot encoding)\n\n## \ud83d\udee0\ufe0f Development\n\n1. Setup environment:\n```bash\npython -m venv venv\nsource venv/bin/activate # On Windows: venv\\Scripts\\activate\ngit clone https://github.com/PriorLabs/TabPFN.git\ncd TabPFN\npip install -e \".[dev]\"\npre-commit install\n```\n\n2. Before committing:\n```bash\npre-commit run --all-files\n```\n\n3. Run tests:\n```bash\npytest tests/\n```\n\n---\n\nBuilt with \u2764\ufe0f by [Prior Labs](https://priorlabs.ai) - Copyright (c) 2025 Prior Labs GmbH\n",
"bugtrack_url": null,
"license": "\n Prior Labs License\n Version 1.1, May 2025\n http://priorlabs.ai/tabpfn-license\n \n This license is a derivative of the Apache 2.0 license\n (http://www.apache.org/licenses/) with a single modification:\n The added Paragraph 10 introduces an enhanced attribution requirement\n inspired by the Llama 3 license.\n \n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n \n 1. Definitions.\n \n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n \n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n \n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n \n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n \n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n \n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n \n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n \n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n \n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n \n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n \n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n \n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n \n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n \n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n \n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n \n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n \n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n \n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n \n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n \n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n \n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n \n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n \n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n \n ---------------------- ADDITIONAL PROVISION --------------------------\n \n 10. Additional attribution.\n If You distribute or make available the Work or any Derivative\n Work thereof relating to any part of the source or model weights,\n or a product or service (including another AI model) that contains\n any source or model weights, You shall (A) provide a copy of this\n License with any such materials; and (B) prominently display\n \u201cBuilt with PriorLabs-TabPFN\u201d on each related website, user interface, blogpost,\n about page, or product documentation. If You use the source or model\n weights or model outputs to create, train, fine tune, distil, or\n otherwise improve an AI model, which is distributed or made available,\n you shall also include \u201cTabPFN\u201d at the beginning of any such AI model name.\n To clarify, internal benchmarking and testing without external\n communication shall not qualify as distribution or making available\n pursuant to this Section 10 and no attribution under this Section 10\n shall be required.\n \n \n END OF TERMS AND CONDITIONS\n ",
"summary": "TabPFN: Foundation model for tabular data",
"version": "2.1.0",
"project_urls": {
"documentation": "https://priorlabs.ai/docs",
"source": "https://github.com/priorlabs/tabpfn"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "47d6dcec05d0e7d9f41d8501167f15c6a046b38e1d90bb34e6c91863915e9fe1",
"md5": "1e0dbd8b381381aaaff25c357fc86391",
"sha256": "db99d7573626fa47ab27b7f03ee6a7a24e505b1dd6bfab66634fff96c1b0d436"
},
"downloads": -1,
"filename": "tabpfn-2.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1e0dbd8b381381aaaff25c357fc86391",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 155495,
"upload_time": "2025-07-09T16:29:13",
"upload_time_iso_8601": "2025-07-09T16:29:13.914320Z",
"url": "https://files.pythonhosted.org/packages/47/d6/dcec05d0e7d9f41d8501167f15c6a046b38e1d90bb34e6c91863915e9fe1/tabpfn-2.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "353aa195dab09d94766b16837810ae8064079158193532923b96f22a95ed7024",
"md5": "fb1275b64e5810a81b2a76a4933eb3af",
"sha256": "bb74732d63a7cd419aaf71fbfeacd12c1a717b0a50342ae17f0736ddbad04dc5"
},
"downloads": -1,
"filename": "tabpfn-2.1.0.tar.gz",
"has_sig": false,
"md5_digest": "fb1275b64e5810a81b2a76a4933eb3af",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 179399,
"upload_time": "2025-07-09T16:29:15",
"upload_time_iso_8601": "2025-07-09T16:29:15.510562Z",
"url": "https://files.pythonhosted.org/packages/35/3a/a195dab09d94766b16837810ae8064079158193532923b96f22a95ed7024/tabpfn-2.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-09 16:29:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "priorlabs",
"github_project": "tabpfn",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tabpfn"
}