The package contains a few selected association rule mining algorithms.
Project description
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
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
- agaricus-lepiota.data: Mushroom dataset
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 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
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
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")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rule_mining_algs-0.1.1.tar.gz.
File metadata
- Download URL: rule_mining_algs-0.1.1.tar.gz
- Upload date:
- Size: 127.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
378fcc56f0cb75d2e243e4e618c28f36801b22515008fc6f29e8002439697085
|
|
| MD5 |
3f6e371b9f06f2d858d967a1a344f1c7
|
|
| BLAKE2b-256 |
b733677e12f6e324f6fa4fa0b9a7a7a7d30c39ce5a8750ae5b592087561fa1d1
|
File details
Details for the file rule_mining_algs-0.1.1-py3-none-any.whl.
File metadata
- Download URL: rule_mining_algs-0.1.1-py3-none-any.whl
- Upload date:
- Size: 117.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b1ae708d1616cbbab303ffa935f422c78085c47ea2150cfcd09fb3bc7b54512
|
|
| MD5 |
a0c45025758ff1a53425ec8a840315c9
|
|
| BLAKE2b-256 |
79b1c4909dcd4afd86d1f4c77b78c92d8b881134079baa7861b7bc95c3b42a27
|