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
Base package can be installed from PyPi:
pip install decision-rules
Besides the base package, additional dependencies are required to use the ruleset_factories module. To install these extras, run:
pip install decision-rules[ruleset_factories]
You can also just clone the repository and install the package locally:
pip install .
or with the extras:
pip install .[ruleset_factories]
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
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 decision_rules-1.3.1.tar.gz.
File metadata
- Download URL: decision_rules-1.3.1.tar.gz
- Upload date:
- Size: 88.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d6b4860c5dfb44ac9c6852767c7f8985277bed7d63b9a02370ef13665e63b00
|
|
| MD5 |
4195eef101a8edac69304c3aa4abc4cd
|
|
| BLAKE2b-256 |
4cac90abaf457a4b60dc5a8c49fb258e5b68254cc458cfe3764a52cbde839c41
|
Provenance
The following attestation bundles were made for decision_rules-1.3.1.tar.gz:
Publisher:
publish-to-pypi.yml on ruleminer/decision-rules
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
decision_rules-1.3.1.tar.gz -
Subject digest:
6d6b4860c5dfb44ac9c6852767c7f8985277bed7d63b9a02370ef13665e63b00 - Sigstore transparency entry: 153083646
- Sigstore integration time:
-
Permalink:
ruleminer/decision-rules@77512e09eaed873bd6934db91e06a8bd3b49e42a -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/ruleminer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@77512e09eaed873bd6934db91e06a8bd3b49e42a -
Trigger Event:
release
-
Statement type:
File details
Details for the file decision_rules-1.3.1-py3-none-any.whl.
File metadata
- Download URL: decision_rules-1.3.1-py3-none-any.whl
- Upload date:
- Size: 149.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6b6c58aa9b95432f4aa5c87e5a81d2faccc3ed2d12be343d949c46be3579f8c
|
|
| MD5 |
39f90218c7b436357de813f6f8ad486c
|
|
| BLAKE2b-256 |
f3662ae75b0800c1bdacbeb046fd620d52f6d2374237b1a132410acfe5795b1a
|
Provenance
The following attestation bundles were made for decision_rules-1.3.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on ruleminer/decision-rules
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
decision_rules-1.3.1-py3-none-any.whl -
Subject digest:
e6b6c58aa9b95432f4aa5c87e5a81d2faccc3ed2d12be343d949c46be3579f8c - Sigstore transparency entry: 153083648
- Sigstore integration time:
-
Permalink:
ruleminer/decision-rules@77512e09eaed873bd6934db91e06a8bd3b49e42a -
Branch / Tag:
refs/tags/v1.3.1 - Owner: https://github.com/ruleminer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@77512e09eaed873bd6934db91e06a8bd3b49e42a -
Trigger Event:
release
-
Statement type: