rule-mining-algs


Namerule-mining-algs JSON
Version 0.1.1 PyPI version JSON
download
home_page
SummaryThe package contains a few selected association rule mining algorithms.
upload_time2023-03-17 20:47:34
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) 2022 JosWrf Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords association rule mining
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Repository for Assocation Rule Mining Algorithms

Several algorithms for mining association rules have been implemented in this repository.

NOTE: The algorithms are implemented in pure Python which makes them rather slow.

## Installation

```bash
pip install rule-mining-algs
```

## Different Algorithms thus far

- AIS
- Apriori
- FP-Growth
- h-Clique (all-confidence pushed into Apriori-algorithm)
- Quantitative Association Rules
- AClose
- Minimal Non-redundant rules
- Rule Generation for apriori-like Algorithms
- Brute-Force Mining of Classification Rules
- Clustering to find intervals for numeric attributes
- Evolutionary Algorithm to Discover Itemsets (GAR)
- Evolutionary Algorithm to Discover Rules with fixed consequent (GAR-PLUS)

## Datasets

- store_data.csv: [Store data](https://user.informatik.uni-goettingen.de/~sherbold/store_data.csv)
- agaricus-lepiota.data: [Mushroom dataset](https://archive.ics.uci.edu/ml/datasets/mushroom)

## Build and Run models

- Transformers: static_discretization(equi-depth/width partitioning of numeric attributes),
  cluster_interval_data(birch clustering to find intervals for numeric attributes)
- Itemset_Miners: see [Algorithms](#Different-Algorithms-thus-far) section
- Rule_Miners: generate_rules(Standard algorithm to generate rules from itemsets),
  min_redundant_rules(only usable with a_close itemset miner)

---

**Example for a dataset with a single attribute**

```python
from algs.models import StandardMiner
from algs.data import load_store_data

data_df = load_store_data() # Load store dataset
# Choose model
m = StandardMiner()
# Set parameters for the algorithms
m.set_args(m.itemset_miner, {"min_support": 0.005})
m.set_args(m.rule_miner, {"min_conf": 0.5})
# Run the algorithm on the dataset
output = m.run(data_df)
```

**Example for a DB containing several categorical attributes**

```python
from algs.data import load_shroom_data
from algs.quantitative import static_discretization
from algs.rule_gen import get_classification_rules

shrooms = load_shroom_data()
mine_quant = StandardMiner(static_discretization)
names = {name: 0 for name in shrooms.columns}
# Set arguments for transformer, itemset and rule miner
mine_quant.set_args(mine_quant.transformer, {"discretization": names})
mine_quant.set_args(mine_quant.itemset_miner, {"min_support": 0.15})
mine_quant.set_args(mine_quant.rule_miner, {"min_conf": 0.65})
rules = mine_quant.run(shrooms)
# Post processing step to obtain rules having only the label in the consequent
classification_rules = get_classification_rules(rules, "label")
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "rule-mining-algs",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "Association Rule Mining",
    "author": "",
    "author_email": "Josef W\u00fcrf <sepp2357@yahoo.de>",
    "download_url": "https://files.pythonhosted.org/packages/b7/33/677e12f6e324f6fa4fa0b9a7a7a7d30c39ce5a8750ae5b592087561fa1d1/rule_mining_algs-0.1.1.tar.gz",
    "platform": null,
    "description": "# Repository for Assocation Rule Mining Algorithms\r\n\r\nSeveral algorithms for mining association rules have been implemented in this repository.\r\n\r\nNOTE: The algorithms are implemented in pure Python which makes them rather slow.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install rule-mining-algs\r\n```\r\n\r\n## Different Algorithms thus far\r\n\r\n- AIS\r\n- Apriori\r\n- FP-Growth\r\n- h-Clique (all-confidence pushed into Apriori-algorithm)\r\n- Quantitative Association Rules\r\n- AClose\r\n- Minimal Non-redundant rules\r\n- Rule Generation for apriori-like Algorithms\r\n- Brute-Force Mining of Classification Rules\r\n- Clustering to find intervals for numeric attributes\r\n- Evolutionary Algorithm to Discover Itemsets (GAR)\r\n- Evolutionary Algorithm to Discover Rules with fixed consequent (GAR-PLUS)\r\n\r\n## Datasets\r\n\r\n- store_data.csv: [Store data](https://user.informatik.uni-goettingen.de/~sherbold/store_data.csv)\r\n- agaricus-lepiota.data: [Mushroom dataset](https://archive.ics.uci.edu/ml/datasets/mushroom)\r\n\r\n## Build and Run models\r\n\r\n- Transformers: static_discretization(equi-depth/width partitioning of numeric attributes),\r\n  cluster_interval_data(birch clustering to find intervals for numeric attributes)\r\n- Itemset_Miners: see [Algorithms](#Different-Algorithms-thus-far) section\r\n- Rule_Miners: generate_rules(Standard algorithm to generate rules from itemsets),\r\n  min_redundant_rules(only usable with a_close itemset miner)\r\n\r\n---\r\n\r\n**Example for a dataset with a single attribute**\r\n\r\n```python\r\nfrom algs.models import StandardMiner\r\nfrom algs.data import load_store_data\r\n\r\ndata_df = load_store_data() # Load store dataset\r\n# Choose model\r\nm = StandardMiner()\r\n# Set parameters for the algorithms\r\nm.set_args(m.itemset_miner, {\"min_support\": 0.005})\r\nm.set_args(m.rule_miner, {\"min_conf\": 0.5})\r\n# Run the algorithm on the dataset\r\noutput = m.run(data_df)\r\n```\r\n\r\n**Example for a DB containing several categorical attributes**\r\n\r\n```python\r\nfrom algs.data import load_shroom_data\r\nfrom algs.quantitative import static_discretization\r\nfrom algs.rule_gen import get_classification_rules\r\n\r\nshrooms = load_shroom_data()\r\nmine_quant = StandardMiner(static_discretization)\r\nnames = {name: 0 for name in shrooms.columns}\r\n# Set arguments for transformer, itemset and rule miner\r\nmine_quant.set_args(mine_quant.transformer, {\"discretization\": names})\r\nmine_quant.set_args(mine_quant.itemset_miner, {\"min_support\": 0.15})\r\nmine_quant.set_args(mine_quant.rule_miner, {\"min_conf\": 0.65})\r\nrules = mine_quant.run(shrooms)\r\n# Post processing step to obtain rules having only the label in the consequent\r\nclassification_rules = get_classification_rules(rules, \"label\")\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 JosWrf  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "The package contains a few selected association rule mining algorithms.",
    "version": "0.1.1",
    "split_keywords": [
        "association",
        "rule",
        "mining"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "79b1c4909dcd4afd86d1f4c77b78c92d8b881134079baa7861b7bc95c3b42a27",
                "md5": "a0c45025758ff1a53425ec8a840315c9",
                "sha256": "3b1ae708d1616cbbab303ffa935f422c78085c47ea2150cfcd09fb3bc7b54512"
            },
            "downloads": -1,
            "filename": "rule_mining_algs-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a0c45025758ff1a53425ec8a840315c9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 117175,
            "upload_time": "2023-03-17T20:47:31",
            "upload_time_iso_8601": "2023-03-17T20:47:31.318800Z",
            "url": "https://files.pythonhosted.org/packages/79/b1/c4909dcd4afd86d1f4c77b78c92d8b881134079baa7861b7bc95c3b42a27/rule_mining_algs-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b733677e12f6e324f6fa4fa0b9a7a7a7d30c39ce5a8750ae5b592087561fa1d1",
                "md5": "3f6e371b9f06f2d858d967a1a344f1c7",
                "sha256": "378fcc56f0cb75d2e243e4e618c28f36801b22515008fc6f29e8002439697085"
            },
            "downloads": -1,
            "filename": "rule_mining_algs-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3f6e371b9f06f2d858d967a1a344f1c7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 127201,
            "upload_time": "2023-03-17T20:47:34",
            "upload_time_iso_8601": "2023-03-17T20:47:34.073095Z",
            "url": "https://files.pythonhosted.org/packages/b7/33/677e12f6e324f6fa4fa0b9a7a7a7d30c39ce5a8750ae5b592087561fa1d1/rule_mining_algs-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-17 20:47:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "rule-mining-algs"
}
        
Elapsed time: 1.16857s