Skip to main content

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.

Metadata

Release files for decision-rules 1.9.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for decision-rules 1.9.2
File Size Uploaded
decision_rules-1.9.2.tar.gz 115.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for decision-rules 1.9.2
File Interpreter ABI Platform
decision_rules-1.9.2-py3-none-any.whl Python 3 none any Details

Total release size: 307.6 kB

Release files / decision_rules-1.9.2.tar.gz

Download URL decision_rules-1.9.2.tar.gz
Size 115.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cf90b1dfac051485cc26e8f67755c7511cd62c7b8180b8abfa164cb1f56b6326
BLAKE2b-256 checksum
How to use checksums
728c23c5163853f09abc5c031b6eccb4e065ed0c350c23e28bd296f6a62eeb07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release files / decision_rules-1.9.2-py3-none-any.whl

Download URL decision_rules-1.9.2-py3-none-any.whl
Size 191.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9be9a2d92488a960650a317dcc3aca3751499136594c5110cf1bc432879eaca1
BLAKE2b-256 checksum
How to use checksums
17d19c4c42e9b2adc46fba1f9bee1f55716b26de20dd3e8fff3627e1cee26231
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.9.2 This release

2 release files

1.4.1

2 release files

1.3.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page