r2ntab


Namer2ntab JSON
Version 1.0.3 PyPI version JSON
download
home_page
SummaryInterpretable machine learning model for binary classification combining deep learning and rule learning
upload_time2023-12-01 15:16:43
maintainer
docs_urlNone
authorM.J. van der Zwart
requires_python>=3.8
license
keywords python rule learning neural networks deep learning classification
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Developed by M.J. van der Zwart as MSc thesis project (c) 2023

## Installation

```
pip install r2ntab
```

## Preparing data using sample dataset

```python
import torch

from r2ntab import transform_dataset, kfold_dataset

name = 'adult.data'
X, Y, X_headers, Y_headers = transform_dataset(name, method='onehot-compare',
negations=False, labels='binary')
datasets = kfold_dataset(X, Y, shuffle=1)
X_train, X_test, Y_train, Y_test = datasets[0]
train_set = torch.utils.data.TensorDataset(torch.Tensor(X_train.to_numpy()),
torch.Tensor(Y_train))
```

## Creating and training the model

```python
from r2ntab import R2NTab

model = R2NTab(len(X_headers), 10, 1)
model.fit(train_set, epochs=1000)
Y_pred = model.predict(X_test)
```

## Extracting the results

```python
rules = model.extract_rules(X_headers, print_rules=True)
print(f'AUC: {model.score(Y_pred, Y_test, metric="auc")}')
print(f'# Rules: {len(rules)}')
print(f'# Conditions: {sum(map(len, rules))}')
```

## Contact

For any questions or problems, please open an issue <a href="https://github.com/mrvanderzwart/R2N-Tab">here</a> on GitHub.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "r2ntab",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "python,rule learning,neural networks,deep learning,classification",
    "author": "M.J. van der Zwart",
    "author_email": "mvdzwart01@hotmail.nl",
    "download_url": "https://files.pythonhosted.org/packages/b2/7d/3b02a5235ccbc8466f1e524abc1035b094bdba1c64742e1bc50a011fec98/r2ntab-1.0.3.tar.gz",
    "platform": null,
    "description": "Developed by M.J. van der Zwart as MSc thesis project (c) 2023\n\n## Installation\n\n```\npip install r2ntab\n```\n\n## Preparing data using sample dataset\n\n```python\nimport torch\n\nfrom r2ntab import transform_dataset, kfold_dataset\n\nname = 'adult.data'\nX, Y, X_headers, Y_headers = transform_dataset(name, method='onehot-compare',\nnegations=False, labels='binary')\ndatasets = kfold_dataset(X, Y, shuffle=1)\nX_train, X_test, Y_train, Y_test = datasets[0]\ntrain_set = torch.utils.data.TensorDataset(torch.Tensor(X_train.to_numpy()),\ntorch.Tensor(Y_train))\n```\n\n## Creating and training the model\n\n```python\nfrom r2ntab import R2NTab\n\nmodel = R2NTab(len(X_headers), 10, 1)\nmodel.fit(train_set, epochs=1000)\nY_pred = model.predict(X_test)\n```\n\n## Extracting the results\n\n```python\nrules = model.extract_rules(X_headers, print_rules=True)\nprint(f'AUC: {model.score(Y_pred, Y_test, metric=\"auc\")}')\nprint(f'# Rules: {len(rules)}')\nprint(f'# Conditions: {sum(map(len, rules))}')\n```\n\n## Contact\n\nFor any questions or problems, please open an issue <a href=\"https://github.com/mrvanderzwart/R2N-Tab\">here</a> on GitHub.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Interpretable machine learning model for binary classification combining deep learning and rule learning",
    "version": "1.0.3",
    "project_urls": null,
    "split_keywords": [
        "python",
        "rule learning",
        "neural networks",
        "deep learning",
        "classification"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b27d3b02a5235ccbc8466f1e524abc1035b094bdba1c64742e1bc50a011fec98",
                "md5": "bc05b67ba1b66c9668b88ab64e77cdff",
                "sha256": "5f4ed3a21f7409104e13451f86b5d2985a783553f2ce21d75ca0fe4cad4906ae"
            },
            "downloads": -1,
            "filename": "r2ntab-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "bc05b67ba1b66c9668b88ab64e77cdff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 13514,
            "upload_time": "2023-12-01T15:16:43",
            "upload_time_iso_8601": "2023-12-01T15:16:43.494351Z",
            "url": "https://files.pythonhosted.org/packages/b2/7d/3b02a5235ccbc8466f1e524abc1035b094bdba1c64742e1bc50a011fec98/r2ntab-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-01 15:16:43",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "r2ntab"
}
        
Elapsed time: 2.51705s