Skip to main content

Package implementing decision rules. Includes tools for calculations of various measures and indicators, as well as algorithms for filtering rulesets.

Project description

Decision Rules

Package implementing decision rules. The package allows user to define and process decision rules as Python objects and perform operations on datasets to which these rules apply.

Three types of problems are supported:

  • classification
  • regression
  • survival

Functionalities includes, but is not limited to:

  • serialization and deserialization
  • prediction
  • summary statistics
  • comparison between rules (semantic and syntactic)

Installation

Package can be installed from PyPi:

pip install decision-rules

You can also just clone the repository and install the package locally:

pip install .

Extras

Ruleset factories

Module for transforming rule-based models into decision-rules rulesets.

Usage

Module expose only a single function ruleset_factory, which is used to convert RuleKit-type rulesets into decision-rules rulesets.

Example:

from rulekit.classification import RuleClassifier

from decision_rules.ruleset_factories import ruleset_factory
from decision_rules.classification.ruleset import ClassificationRuleSet

rule_classifier = RuleClassifier()
rule_classifier.fit(X, y)

ruleset: ClassificationRuleSet = ruleset_factory(
    model=rule_classifier,
    X_train=X,
    y_train=y,
)

A parser for MLRules-type rulesets has also been implemented and can be found under decision_rules.ruleset_factories._factories.classification.MLRulesRuleSetFactory. Its .make method takes a list of lines read from MLRules algorithm output file, the dataset and (optionally) a voting metric to calculate rule weights.

Example:

with open("example_MLRules_output.txt") as file:
    ml_rules_lines = file.readlines()
ruleset: ClassificationRuleSet = MLRulesRuleSetFactory().make(
    ml_rules_lines, X_df, y_df, "Precision"
)

Running tests

To run tests of the base package, please run:

python -m unittest discover ./tests/base_tests

To run tests of the extras modules, please run:

python -m unittest discover ./tests/extras

Similarly, you can run tests of the whole package by running:

python -m unittest discover ./tests

Documentation

Full documentation along with some usage examples can be found here.

License

The software is licensed under the MIT License. See the LICENSE file for details.

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

decision_rules-1.4.1.tar.gz (89.0 kB view details)

Uploaded Source

Built Distribution

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

decision_rules-1.4.1-py3-none-any.whl (150.0 kB view details)

Uploaded Python 3

File details

Details for the file decision_rules-1.4.1.tar.gz.

File metadata

  • Download URL: decision_rules-1.4.1.tar.gz
  • Upload date:
  • Size: 89.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for decision_rules-1.4.1.tar.gz
Algorithm Hash digest
SHA256 bb143c152dbe15d75902850754d4137a3c01b9d20abb33cf10af7092294fe32b
MD5 3094772883a0ece1f596993375b33af9
BLAKE2b-256 dc3f375e4b85cafaad4288e00ec7713913c02a395392705ed3ca35712e158181

See more details on using hashes here.

Provenance

The following attestation bundles were made for decision_rules-1.4.1.tar.gz:

Publisher: publish-to-pypi.yml on ruleminer/decision-rules

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file decision_rules-1.4.1-py3-none-any.whl.

File metadata

  • Download URL: decision_rules-1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 150.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for decision_rules-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 736be9eb929664d2fca8ad4339d7b0c20254e727267f540651db5a9fe2c91bd9
MD5 d5becc370c870a9238f2f2f357c1df34
BLAKE2b-256 507a3ada7778a3491f63244b9ea0be18d4b3f4dcffebdf0bb7eeddf58ff15667

See more details on using hashes here.

Provenance

The following attestation bundles were made for decision_rules-1.4.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on ruleminer/decision-rules

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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