Metadata-Version: 2.4
Name: ripple_down_rules
Version: 0.0.0
Summary: Implements the various versions of Ripple Down Rules (RDR) for knowledge representation and reasoning.
Author-email: Abdelrhman Bassiouny <abassiou@uni-bremen.de>
Project-URL: Homepage, https://github.com/AbdelrhmanBassiouny/ripple_down_rules
Keywords: robotics,knowledge,reasoning,representation
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: neem_pycram_interface==1.0.167

# 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"](https://doi.org/10.1201/9781003126157) by Paul Compton, Byeong Ho Kang.

## Installation

```bash
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:

```Python
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
scrdr.fit(all_cases, targets,
          animate_tree=True, n_iter=10)

# 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]
```
