# TabNet: Attentive Interpretable Tabular Learning






[](https://codecov.io/gh/DanielAvdar/tabnet/tree/main)
[](https://github.com/astral-sh/ruff)

TabNet is a deep learning architecture designed specifically for tabular data,
combining interpretability and high predictive performance.
This package provides a modern, maintained implementation of TabNet in PyTorch,
supporting classification, regression, multitask learning, and unsupervised pretraining.
## Installation
Install TabNet using pip:
```bash
pip install pytorch-tabnet2
```
## What is TabNet?
TabNet is an interpretable neural network architecture for tabular data, introduced by Arik & Pfister (2019). It uses sequential attention to select which features to reason from at each decision step, enabling both high performance and interpretability. TabNet learns sparse feature masks, allowing users to understand which features are most important for each prediction. The method is particularly effective for structured/tabular datasets where traditional deep learning models often underperform compared to tree-based methods.
Key aspects of TabNet:
- **Attentive Feature Selection**: At each step, TabNet learns which features to focus on, improving both accuracy and interpretability.
- **Interpretable Masks**: The model produces feature masks that highlight the importance of each feature for individual predictions.
- **End-to-End Learning**: Supports classification, regression, multitask, and unsupervised pretraining tasks.
# What problems does pytorch-tabnet handle?
- TabNetClassifier : binary classification and multi-class classification problems.
- TabNetRegressor : simple and multi-task regression problems.
- TabNetMultiTaskClassifier: multi-task multi-classification problems.
- MultiTabNetRegressor: multi-task regression problems, which is basically TabNetRegressor with multiple targets.
## Usage
### [Documentation](https://tabnet.readthedocs.io/en/latest/)
### Basic Examples
**Classification**
```python
import numpy as np
from pytorch_tabnet import TabNetClassifier
# Generate dummy data
X_train = np.random.rand(100, 10)
y_train = np.random.randint(0, 2, 100)
X_valid = np.random.rand(20, 10)
y_valid = np.random.randint(0, 2, 20)
X_test = np.random.rand(10, 10)
clf = TabNetClassifier()
clf.fit(X_train, y_train, eval_set=[(X_valid, y_valid)])
preds = clf.predict(X_test)
print('Predictions:', preds)
```
**Regression**
```python
import numpy as np
from pytorch_tabnet import TabNetRegressor
# Generate dummy data
X_train = np.random.rand(100, 10)
y_train = np.random.rand(100).reshape(-1, 1)
X_valid = np.random.rand(20, 10)
y_valid = np.random.rand(20).reshape(-1, 1)
X_test = np.random.rand(10, 10)
reg = TabNetRegressor()
reg.fit(X_train, y_train, eval_set=[(X_valid, y_valid)])
preds = reg.predict(X_test)
print('Predictions:', preds)
```
**Multi-task Classification**
```python
import numpy as np
from pytorch_tabnet import TabNetMultiTaskClassifier
# Generate dummy data
X_train = np.random.rand(100, 10)
y_train = np.random.randint(0, 2, (100, 3)) # 3 tasks
X_valid = np.random.rand(20, 10)
y_valid = np.random.randint(0, 2, (20, 3))
X_test = np.random.rand(10, 10)
clf = TabNetMultiTaskClassifier()
clf.fit(X_train, y_train, eval_set=[(X_valid, y_valid)])
preds = clf.predict(X_test)
print('Predictions:', preds)
```
See the [nbs/](nbs/) folder for more complete examples and notebooks.
## Further Reading
- [TabNet: Attentive Interpretable Tabular Learning (Arik & Pfister, 2019)](https://arxiv.org/pdf/1908.07442.pdf)
- Original repo: https://github.com/dreamquark-ai/tabnet
## License & Credits
- Original implementation and research by [DreamQuark team](https://github.com/dreamquark-ai/tabnet)
- Maintained and improved by Daniel Avdar and contributors
- See LICENSE for details
Raw data
{
"_id": null,
"home_page": null,
"name": "pytorch-tabnet2",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "neural-networks, pytorch, tabnet",
"author": "DreamQuark",
"author_email": "DanielAvdar <66269169+DanielAvdar@users.noreply.github.com>",
"download_url": "https://files.pythonhosted.org/packages/f4/9f/e58fee8096c98be1e7e89cf034f33c53a963e96fa84e55a1387a44a08094/pytorch_tabnet2-4.5.2.tar.gz",
"platform": null,
"description": "# TabNet: Attentive Interpretable Tabular Learning\n\n\n\n\n\n\n\n[](https://codecov.io/gh/DanielAvdar/tabnet/tree/main)\n[](https://github.com/astral-sh/ruff)\n\n\n\nTabNet is a deep learning architecture designed specifically for tabular data,\ncombining interpretability and high predictive performance.\nThis package provides a modern, maintained implementation of TabNet in PyTorch,\nsupporting classification, regression, multitask learning, and unsupervised pretraining.\n\n\n## Installation\n\nInstall TabNet using pip:\n\n```bash\npip install pytorch-tabnet2\n```\n\n## What is TabNet?\nTabNet is an interpretable neural network architecture for tabular data, introduced by Arik & Pfister (2019). It uses sequential attention to select which features to reason from at each decision step, enabling both high performance and interpretability. TabNet learns sparse feature masks, allowing users to understand which features are most important for each prediction. The method is particularly effective for structured/tabular datasets where traditional deep learning models often underperform compared to tree-based methods.\n\nKey aspects of TabNet:\n- **Attentive Feature Selection**: At each step, TabNet learns which features to focus on, improving both accuracy and interpretability.\n- **Interpretable Masks**: The model produces feature masks that highlight the importance of each feature for individual predictions.\n- **End-to-End Learning**: Supports classification, regression, multitask, and unsupervised pretraining tasks.\n\n# What problems does pytorch-tabnet handle?\n\n- TabNetClassifier : binary classification and multi-class classification problems.\n- TabNetRegressor : simple and multi-task regression problems.\n- TabNetMultiTaskClassifier: multi-task multi-classification problems.\n- MultiTabNetRegressor: multi-task regression problems, which is basically TabNetRegressor with multiple targets.\n\n\n## Usage\n\n### [Documentation](https://tabnet.readthedocs.io/en/latest/)\n\n\n### Basic Examples\n\n**Classification**\n```python\nimport numpy as np\nfrom pytorch_tabnet import TabNetClassifier\n\n# Generate dummy data\nX_train = np.random.rand(100, 10)\ny_train = np.random.randint(0, 2, 100)\nX_valid = np.random.rand(20, 10)\ny_valid = np.random.randint(0, 2, 20)\nX_test = np.random.rand(10, 10)\n\nclf = TabNetClassifier()\nclf.fit(X_train, y_train, eval_set=[(X_valid, y_valid)])\npreds = clf.predict(X_test)\nprint('Predictions:', preds)\n```\n\n**Regression**\n```python\nimport numpy as np\nfrom pytorch_tabnet import TabNetRegressor\n\n# Generate dummy data\nX_train = np.random.rand(100, 10)\ny_train = np.random.rand(100).reshape(-1, 1)\nX_valid = np.random.rand(20, 10)\ny_valid = np.random.rand(20).reshape(-1, 1)\nX_test = np.random.rand(10, 10)\n\nreg = TabNetRegressor()\nreg.fit(X_train, y_train, eval_set=[(X_valid, y_valid)])\npreds = reg.predict(X_test)\nprint('Predictions:', preds)\n```\n\n**Multi-task Classification**\n```python\nimport numpy as np\nfrom pytorch_tabnet import TabNetMultiTaskClassifier\n\n# Generate dummy data\nX_train = np.random.rand(100, 10)\ny_train = np.random.randint(0, 2, (100, 3)) # 3 tasks\nX_valid = np.random.rand(20, 10)\ny_valid = np.random.randint(0, 2, (20, 3))\nX_test = np.random.rand(10, 10)\n\nclf = TabNetMultiTaskClassifier()\nclf.fit(X_train, y_train, eval_set=[(X_valid, y_valid)])\npreds = clf.predict(X_test)\nprint('Predictions:', preds)\n```\n\nSee the [nbs/](nbs/) folder for more complete examples and notebooks.\n\n## Further Reading\n- [TabNet: Attentive Interpretable Tabular Learning (Arik & Pfister, 2019)](https://arxiv.org/pdf/1908.07442.pdf)\n- Original repo: https://github.com/dreamquark-ai/tabnet\n\n## License & Credits\n- Original implementation and research by [DreamQuark team](https://github.com/dreamquark-ai/tabnet)\n- Maintained and improved by Daniel Avdar and contributors\n- See LICENSE for details\n",
"bugtrack_url": null,
"license": null,
"summary": "PyTorch implementation of TabNet",
"version": "4.5.2",
"project_urls": null,
"split_keywords": [
"neural-networks",
" pytorch",
" tabnet"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2055cf468c5ed817e5ec1b9333f6bb940e62209d0507013deda7d0824cc3327f",
"md5": "0048305e900bb8ec09e3504ac925c95c",
"sha256": "f58c393e2109caa523767e09eeafac725f22d859a35dd0594fa4a74d3cceaf00"
},
"downloads": -1,
"filename": "pytorch_tabnet2-4.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0048305e900bb8ec09e3504ac925c95c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 70752,
"upload_time": "2025-11-01T16:24:19",
"upload_time_iso_8601": "2025-11-01T16:24:19.987620Z",
"url": "https://files.pythonhosted.org/packages/20/55/cf468c5ed817e5ec1b9333f6bb940e62209d0507013deda7d0824cc3327f/pytorch_tabnet2-4.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f49fe58fee8096c98be1e7e89cf034f33c53a963e96fa84e55a1387a44a08094",
"md5": "426c0f239b65fe9a125e3a147eede443",
"sha256": "4175d7d4b0e39dc45c8f3e0b3211a6c2405d62a19c347857c3ce9387f78a9a3c"
},
"downloads": -1,
"filename": "pytorch_tabnet2-4.5.2.tar.gz",
"has_sig": false,
"md5_digest": "426c0f239b65fe9a125e3a147eede443",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 40110,
"upload_time": "2025-11-01T16:24:21",
"upload_time_iso_8601": "2025-11-01T16:24:21.132809Z",
"url": "https://files.pythonhosted.org/packages/f4/9f/e58fee8096c98be1e7e89cf034f33c53a963e96fa84e55a1387a44a08094/pytorch_tabnet2-4.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-01 16:24:21",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pytorch-tabnet2"
}