Skip to main content

Implements the various versions of Ripple Down Rules (RDR) for knowledge representation and reasoning.

Project description

Ripple Down Rules (RDR)

A python implementation of the various ripple down rules versions, including Single Classification (SCRDR), Multi Classification (MCRDR), and Generalised Ripple Down Rules (GRDR).

SCRDR, MCRDR, and GRDR are rule-based classifiers that are built incrementally, and can be used to classify data cases. The rules are refined as new data cases are classified.

SCRDR, MCRDR, and GRDR implementation were inspired from the book: "Ripple Down Rules: An Alternative to Machine Learning" by Paul Compton, Byeong Ho Kang.

Installation

sudo apt-get install graphviz graphviz-dev
pip install ripple_down_rules

For GUI support, also install:

sudo apt-get install libxcb-cursor-dev
## Example Usage

Fit the SCRDR to the data, then classify one of the data cases to check if its correct,
and render the tree to a file:
from ripple_down_rules.datastructures.dataclasses import CaseQuery
from ripple_down_rules.rdr import SingleClassRDR
from ripple_down_rules.datasets import load_zoo_dataset
from ripple_down_rules.utils import render_tree

all_cases, targets = load_zoo_dataset()

scrdr = SingleClassRDR()

# Fit the SCRDR to the data
case_queries = [CaseQuery(case, 'species', type(target), True, _target=target)
                for case, target in zip(all_cases[:10], targets[:10])]
scrdr.fit(case_queries, animate_tree=True)

# Render the tree to a file
render_tree(scrdr.start_rule, use_dot_exporter=True, filename="scrdr")

cat = scrdr.classify(all_cases[50])
assert cat == targets[50]

To Cite:

@software{bassiouny2025rdr,
author = {Bassiouny, Abdelrhman},
title = {Ripple-Down-Rules},
url = {https://github.com/AbdelrhmanBassiouny/ripple_down_rules},
version = {0.4.1},
}

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

ripple_down_rules-0.5.0.tar.gz (3.2 MB view details)

Uploaded Source

Built Distribution

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

ripple_down_rules-0.5.0-py3-none-any.whl (91.4 kB view details)

Uploaded Python 3

File details

Details for the file ripple_down_rules-0.5.0.tar.gz.

File metadata

  • Download URL: ripple_down_rules-0.5.0.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ripple_down_rules-0.5.0.tar.gz
Algorithm Hash digest
SHA256 1e7b9582f09c4184c4f8424f0f5486c7cf044452bee8feffc82c619bee944c37
MD5 5432bf021113b2dc1f3903088e3387af
BLAKE2b-256 9018b4b09966a3ac7b4cbc09c580f3bc5f4a1242a160933c806ecfff25656377

See more details on using hashes here.

Provenance

The following attestation bundles were made for ripple_down_rules-0.5.0.tar.gz:

Publisher: publish-to-test-pypi.yml on AbdelrhmanBassiouny/ripple_down_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 ripple_down_rules-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ripple_down_rules-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3bec532cf35dbaf96508bfed66ad5d912386430e0818142f7166d30d676c0f7
MD5 611b54bf863b27120af4db4c0778c251
BLAKE2b-256 6da8d32821857f9d556d1ba1e2536c3a02790a3857db10d94b6653914ce03d1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ripple_down_rules-0.5.0-py3-none-any.whl:

Publisher: publish-to-test-pypi.yml on AbdelrhmanBassiouny/ripple_down_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