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

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 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, target=target) for case, target in zip(all_cases, targets)]
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.fit_case(all_cases[50], targets[50])
assert cat == targets[50]

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.0.11.tar.gz (70.0 kB 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.0.11-py3-none-any.whl (57.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ripple_down_rules-0.0.11.tar.gz
  • Upload date:
  • Size: 70.0 kB
  • 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.0.11.tar.gz
Algorithm Hash digest
SHA256 730dff2999c5b5916925790d7e8d854512a71e062bd2b23f071fa9ec6a128fad
MD5 bfc9ce7da90ddd1bcb830a13194c6caa
BLAKE2b-256 88341d42a3bc718e3387557a584627300713a8c3d84d88d3ec0dfaae29db48a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for ripple_down_rules-0.0.11.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.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for ripple_down_rules-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 7b6e97b6eedaab81b838ccaa45aa2c87cacd9b53f300c1dd8a269e751e3c7951
MD5 930172de5e202193a95685486c7df443
BLAKE2b-256 88526c6c597dfedd4aa47bf892850dad656f1baae1cf6de5e40a564ee15dea23

See more details on using hashes here.

Provenance

The following attestation bundles were made for ripple_down_rules-0.0.11-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