ripple-down-rules 0.0.1__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/PKG-INFO +4 -4
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/README.md +3 -2
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/pyproject.toml +2 -3
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/datasets.py +13 -6
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules.egg-info/PKG-INFO +4 -4
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules.egg-info/SOURCES.txt +0 -1
- ripple_down_rules-0.0.1/src/ripple_down_rules.egg-info/requires.txt +0 -1
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/setup.cfg +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/__init__.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/datastructures/__init__.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/datastructures/callable_expression.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/datastructures/dataclasses.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/datastructures/enums.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/datastructures/generated/__init__.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/datastructures/generated/column/__init__.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/datastructures/generated/row/__init__.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/datastructures/table.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/experts.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/failures.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/prompt.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/rdr.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/rules.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/utils.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules.egg-info/dependency_links.txt +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules.egg-info/top_level.txt +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/test/test_json_serialization.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/test/test_rdr.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/test/test_rdr_alchemy.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/test/test_relational_rdr.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/test/test_relational_rdr_alchemy.py +0 -0
- {ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/test/test_sql_model.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ripple_down_rules
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.3
|
4
4
|
Summary: Implements the various versions of Ripple Down Rules (RDR) for knowledge representation and reasoning.
|
5
5
|
Author-email: Abdelrhman Bassiouny <abassiou@uni-bremen.de>
|
6
6
|
Project-URL: Homepage, https://github.com/AbdelrhmanBassiouny/ripple_down_rules
|
@@ -8,7 +8,6 @@ Keywords: robotics,knowledge,reasoning,representation
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
9
9
|
Requires-Python: >=3.8
|
10
10
|
Description-Content-Type: text/markdown
|
11
|
-
Requires-Dist: neem_pycram_interface==1.0.167
|
12
11
|
|
13
12
|
# Ripple Down Rules (RDR)
|
14
13
|
|
@@ -34,6 +33,7 @@ Fit the SCRDR to the data, then classify one of the data cases to check if its c
|
|
34
33
|
and render the tree to a file:
|
35
34
|
|
36
35
|
```Python
|
36
|
+
from ripple_down_rules.datastructures import CaseQuery
|
37
37
|
from ripple_down_rules.rdr import SingleClassRDR
|
38
38
|
from ripple_down_rules.datasets import load_zoo_dataset
|
39
39
|
from ripple_down_rules.utils import render_tree
|
@@ -43,8 +43,8 @@ all_cases, targets = load_zoo_dataset()
|
|
43
43
|
scrdr = SingleClassRDR()
|
44
44
|
|
45
45
|
# Fit the SCRDR to the data
|
46
|
-
|
47
|
-
|
46
|
+
case_queries = [CaseQuery(case, target=target) for case, target in zip(all_cases, targets)]
|
47
|
+
scrdr.fit(case_queries, animate_tree=True)
|
48
48
|
|
49
49
|
# Render the tree to a file
|
50
50
|
render_tree(scrdr.start_rule, use_dot_exporter=True, filename="scrdr")
|
@@ -22,6 +22,7 @@ Fit the SCRDR to the data, then classify one of the data cases to check if its c
|
|
22
22
|
and render the tree to a file:
|
23
23
|
|
24
24
|
```Python
|
25
|
+
from ripple_down_rules.datastructures import CaseQuery
|
25
26
|
from ripple_down_rules.rdr import SingleClassRDR
|
26
27
|
from ripple_down_rules.datasets import load_zoo_dataset
|
27
28
|
from ripple_down_rules.utils import render_tree
|
@@ -31,8 +32,8 @@ all_cases, targets = load_zoo_dataset()
|
|
31
32
|
scrdr = SingleClassRDR()
|
32
33
|
|
33
34
|
# Fit the SCRDR to the data
|
34
|
-
|
35
|
-
|
35
|
+
case_queries = [CaseQuery(case, target=target) for case, target in zip(all_cases, targets)]
|
36
|
+
scrdr.fit(case_queries, animate_tree=True)
|
36
37
|
|
37
38
|
# Render the tree to a file
|
38
39
|
render_tree(scrdr.start_rule, use_dot_exporter=True, filename="scrdr")
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
6
6
|
|
7
7
|
[project]
|
8
8
|
name = "ripple_down_rules"
|
9
|
-
version = "0.0.
|
9
|
+
version = "0.0.3"
|
10
10
|
description = "Implements the various versions of Ripple Down Rules (RDR) for knowledge representation and reasoning."
|
11
11
|
readme = "README.md"
|
12
12
|
authors = [{ name = "Abdelrhman Bassiouny", email = "abassiou@uni-bremen.de" }]
|
@@ -15,8 +15,7 @@ classifiers = [
|
|
15
15
|
"Programming Language :: Python :: 3",
|
16
16
|
]
|
17
17
|
keywords = ["robotics", "knowledge", "reasoning", "representation"]
|
18
|
-
dependencies = [
|
19
|
-
]
|
18
|
+
dependencies = []
|
20
19
|
requires-python = ">=3.8"
|
21
20
|
|
22
21
|
[project.urls]
|
@@ -6,7 +6,7 @@ import pickle
|
|
6
6
|
import sqlalchemy
|
7
7
|
from sqlalchemy import ForeignKey
|
8
8
|
from sqlalchemy.orm import MappedAsDataclass, Mapped, mapped_column, relationship
|
9
|
-
from typing_extensions import Tuple, List, Set
|
9
|
+
from typing_extensions import Tuple, List, Set, Optional
|
10
10
|
from ucimlrepo import fetch_ucirepo
|
11
11
|
|
12
12
|
from .datastructures import Case, create_rows_from_dataframe, Category, Column
|
@@ -38,9 +38,9 @@ def save_dataset_to_cache(dataset, cache_file):
|
|
38
38
|
print("Dataset cached successfully.")
|
39
39
|
|
40
40
|
|
41
|
-
def get_dataset(dataset_id, cache_file):
|
41
|
+
def get_dataset(dataset_id, cache_file: Optional[str] = None):
|
42
42
|
"""Fetches dataset from cache or downloads it if not available."""
|
43
|
-
dataset = load_cached_dataset(cache_file)
|
43
|
+
dataset = load_cached_dataset(cache_file) if cache_file else None
|
44
44
|
if dataset is None:
|
45
45
|
print("Downloading dataset...")
|
46
46
|
dataset = fetch_ucirepo(id=dataset_id)
|
@@ -50,16 +50,23 @@ def get_dataset(dataset_id, cache_file):
|
|
50
50
|
print("Error: Failed to fetch dataset.")
|
51
51
|
return None
|
52
52
|
|
53
|
-
|
53
|
+
if cache_file:
|
54
|
+
save_dataset_to_cache(dataset, cache_file)
|
55
|
+
|
56
|
+
dataset = {
|
57
|
+
"features": dataset.data.features,
|
58
|
+
"targets": dataset.data.targets,
|
59
|
+
"ids": dataset.data.ids,
|
60
|
+
}
|
54
61
|
|
55
62
|
return dataset
|
56
63
|
|
57
64
|
|
58
|
-
def load_zoo_dataset(cache_file: str) -> Tuple[List[Case], List[Species]]:
|
65
|
+
def load_zoo_dataset(cache_file: Optional[str] = None) -> Tuple[List[Case], List[Species]]:
|
59
66
|
"""
|
60
67
|
Load the zoo dataset.
|
61
68
|
|
62
|
-
:param cache_file: the cache file.
|
69
|
+
:param cache_file: the cache file to store the dataset or load it from.
|
63
70
|
:return: all cases and targets.
|
64
71
|
"""
|
65
72
|
# fetch dataset
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ripple_down_rules
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.3
|
4
4
|
Summary: Implements the various versions of Ripple Down Rules (RDR) for knowledge representation and reasoning.
|
5
5
|
Author-email: Abdelrhman Bassiouny <abassiou@uni-bremen.de>
|
6
6
|
Project-URL: Homepage, https://github.com/AbdelrhmanBassiouny/ripple_down_rules
|
@@ -8,7 +8,6 @@ Keywords: robotics,knowledge,reasoning,representation
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
9
9
|
Requires-Python: >=3.8
|
10
10
|
Description-Content-Type: text/markdown
|
11
|
-
Requires-Dist: neem_pycram_interface==1.0.167
|
12
11
|
|
13
12
|
# Ripple Down Rules (RDR)
|
14
13
|
|
@@ -34,6 +33,7 @@ Fit the SCRDR to the data, then classify one of the data cases to check if its c
|
|
34
33
|
and render the tree to a file:
|
35
34
|
|
36
35
|
```Python
|
36
|
+
from ripple_down_rules.datastructures import CaseQuery
|
37
37
|
from ripple_down_rules.rdr import SingleClassRDR
|
38
38
|
from ripple_down_rules.datasets import load_zoo_dataset
|
39
39
|
from ripple_down_rules.utils import render_tree
|
@@ -43,8 +43,8 @@ all_cases, targets = load_zoo_dataset()
|
|
43
43
|
scrdr = SingleClassRDR()
|
44
44
|
|
45
45
|
# Fit the SCRDR to the data
|
46
|
-
|
47
|
-
|
46
|
+
case_queries = [CaseQuery(case, target=target) for case, target in zip(all_cases, targets)]
|
47
|
+
scrdr.fit(case_queries, animate_tree=True)
|
48
48
|
|
49
49
|
# Render the tree to a file
|
50
50
|
render_tree(scrdr.start_rule, use_dot_exporter=True, filename="scrdr")
|
{ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules.egg-info/SOURCES.txt
RENAMED
@@ -11,7 +11,6 @@ src/ripple_down_rules/utils.py
|
|
11
11
|
src/ripple_down_rules.egg-info/PKG-INFO
|
12
12
|
src/ripple_down_rules.egg-info/SOURCES.txt
|
13
13
|
src/ripple_down_rules.egg-info/dependency_links.txt
|
14
|
-
src/ripple_down_rules.egg-info/requires.txt
|
15
14
|
src/ripple_down_rules.egg-info/top_level.txt
|
16
15
|
src/ripple_down_rules/datastructures/__init__.py
|
17
16
|
src/ripple_down_rules/datastructures/callable_expression.py
|
@@ -1 +0,0 @@
|
|
1
|
-
neem_pycram_interface==1.0.167
|
File without changes
|
File without changes
|
{ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/datastructures/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/datastructures/enums.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules/datastructures/table.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ripple_down_rules-0.0.1 → ripple_down_rules-0.0.3}/src/ripple_down_rules.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|