Action rules mining package
Project description
Action Rules
Action Rules (actionrules) is an implementation of Action Rules from Classification Rules algorithm described in
Dardzinska, A. (2013). Action rules mining. Berlin: Springer.
GIT repository
https://github.com/lukassykora/actionrules
Installation
pip install actionrules-lukassykora
Jupyter Notebooks
- Titanic It is the best explanation of all possibilities.
- Telco A brief demonstration.
- Ras Based on the example in (Ras, Zbigniew W and Wyrzykowska, ARAS: Action rules discovery based on agglomerative strategy, 2007).
Example 1
Get data from csv. Get action rules from classification rules. Classification rules have confidence 55% and support 3%. Stable part of action rule is "Age". Flexible attributes are "Embarked", "Fare", "Pclass". Target is a Survived value 1.0. No nan values. Use reduction tables for speeding up. Minimal 1 stable antecedent Minimal 1 flexible antecedent
from actionrules.actionRulesDiscovery import ActionRulesDiscovery
actionRulesDiscovery = ActionRulesDiscovery()
actionRulesDiscovery.read_csv("data/titanic.csv", sep="\t")
actionRulesDiscovery.fit(stable_antecedents = ["Age"],
flexible_antecedents = ["Embarked", "Fare", "Pclass"],
consequent = "Survived",
conf=55,
supp=3,
desired_classes = ["1.0"],
is_nan=False,
is_reduction=True,
min_stable_antecedents=1,
min_flexible_antecedents=1,
max_stable_antecedents=5,
max_flexible_antecedents=5)
actionRulesDiscovery.get_action_rules()
The output is a list where the first part is an action rule and the second part is a tuple of (support before, support after, action rule support) and (confidence before, confidence after, action rule confidence).
Example 2
Get data from pandas dataframe. Get action rules from classification rules. Classification rules have confidence 50% and support 3%. Stable attributes are "Age" and "Sex". Flexible attributes are "Embarked", "Fare", "Pclass". Target is a Survived that changes from 0.0 to 1.0. No nan values. Use reduction tables for speeding up. Minimal 1 stable antecedent Minimal 1 flexible antecedent
from actionrules.actionRulesDiscovery import ActionRulesDiscovery
import pandas as pd
dataFrame = pd.read_csv("data/titanic.csv", sep="\t")
actionRulesDiscovery = ActionRulesDiscovery()
actionRulesDiscovery.load_pandas(dataFrame)
actionRulesDiscovery.fit(stable_antecedents = ["Age", "Sex"],
flexible_antecedents = ["Embarked", "Fare", "Pclass"],
consequent = "Survived",
conf=50,
supp=3,
desired_changes = [["0.0", "1.0"]],
is_nan=False,
is_reduction=True,
min_stable_antecedents=1,
min_flexible_antecedents=1,
max_stable_antecedents=5,
max_flexible_antecedents=5)
actionRulesDiscovery.get_pretty_action_rules()
The output is a list of action rules in pretty text form.
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
Hashes for actionrules-lukassykora-1.0.19.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f25a54465e769e3d4c3fcee19a790657a78de672fcff73b13312226f3a01790 |
|
MD5 | df453d8d542e49b12210db7b5a49503d |
|
BLAKE2b-256 | b2d69d759ccc33ec9e1730cff8a0f1389f64c0563f1a7cbdfabfc980d1480784 |
Hashes for actionrules_lukassykora-1.0.19-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8915cf314dba2ff1baa982e76443789418a1f350122177aaa2f7a1dda89b5740 |
|
MD5 | da5b606b868d96fca9e3e4843f0b241e |
|
BLAKE2b-256 | 81ba5b90be35d8e8bee2393d54c4f6441b3b4b1c4b227526809f0decaa3bf7a3 |