Skip to main content

Action rules mining package

Project description

Action Rules

License: MIT

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_attributes = ["Age"],
                         flexible_attributes = ["Embarked", "Fare", "Pclass"],
                         consequent = "Survived",
                         conf=55,
                         supp=3,
                         desired_classes = ["1.0"],
                         is_nan=False,
                         is_reduction=True,
                         min_stable_attributes=1,
                         min_flexible_attributes=1,
                         max_stable_attributes=5,
                         max_flexible_attributes=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_attributes = ["Age", "Sex"],
                         flexible_attributes = ["Embarked", "Fare", "Pclass"],
                         consequent = "Survived",
                         conf=50,
                         supp=3,
                         desired_changes = [["0.0", "1.0"]],
                         is_nan=False,
                         is_reduction=True,
                         min_stable_attributes=1,
                         min_flexible_attributes=1,
                         max_stable_attributes=5,
                         max_flexible_attributes=5)
actionRulesDiscovery.get_pretty_action_rules()

The output is a list of action rules in pretty text form.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

actionrules-lukassykora-1.1.19.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

actionrules_lukassykora-1.1.19-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file actionrules-lukassykora-1.1.19.tar.gz.

File metadata

  • Download URL: actionrules-lukassykora-1.1.19.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for actionrules-lukassykora-1.1.19.tar.gz
Algorithm Hash digest
SHA256 592e4c814b17153470e5e33e7891452c1fda7f4710796173c778f3616348b679
MD5 b11cdcc684bf2e437703fa50a37cfd2d
BLAKE2b-256 c749401e524ce19414a48291ff49deeed006ddbea63ba9f7ca045d22c9d9bddb

See more details on using hashes here.

File details

Details for the file actionrules_lukassykora-1.1.19-py3-none-any.whl.

File metadata

  • Download URL: actionrules_lukassykora-1.1.19-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for actionrules_lukassykora-1.1.19-py3-none-any.whl
Algorithm Hash digest
SHA256 cff2bb4c165242d9ddeb656e87d04fdd1a1d3295a1db766db293e59e110064ca
MD5 a37b0e598dab0cd07cab823e85c2fed8
BLAKE2b-256 252ccd436eb9117e88d16a6865b900e6287a5287be930978d419de5bffc484e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page