ripple-down-rules 0.6.12__py3-none-any.whl → 0.6.14__py3-none-any.whl
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/__init__.py +1 -1
- ripple_down_rules/helpers.py +1 -1
- ripple_down_rules/rdr.py +15 -2
- ripple_down_rules/rdr_decorators.py +4 -5
- ripple_down_rules/user_interface/gui.py +3 -0
- {ripple_down_rules-0.6.12.dist-info → ripple_down_rules-0.6.14.dist-info}/METADATA +1 -1
- {ripple_down_rules-0.6.12.dist-info → ripple_down_rules-0.6.14.dist-info}/RECORD +10 -10
- {ripple_down_rules-0.6.12.dist-info → ripple_down_rules-0.6.14.dist-info}/WHEEL +0 -0
- {ripple_down_rules-0.6.12.dist-info → ripple_down_rules-0.6.14.dist-info}/licenses/LICENSE +0 -0
- {ripple_down_rules-0.6.12.dist-info → ripple_down_rules-0.6.14.dist-info}/top_level.txt +0 -0
ripple_down_rules/__init__.py
CHANGED
ripple_down_rules/helpers.py
CHANGED
@@ -55,7 +55,7 @@ def general_rdr_classify(classifiers_dict: Dict[str, Union[ModuleType, RippleDow
|
|
55
55
|
if attribute_name in new_conclusions:
|
56
56
|
temp_case_query = CaseQuery(case_cp, attribute_name, rdr.conclusion_type, rdr.mutually_exclusive)
|
57
57
|
update_case(temp_case_query, new_conclusions)
|
58
|
-
if len(new_conclusions) == 0
|
58
|
+
if len(new_conclusions) == 0 or len(classifiers_dict) == 1:
|
59
59
|
break
|
60
60
|
return conclusions
|
61
61
|
|
ripple_down_rules/rdr.py
CHANGED
@@ -92,8 +92,21 @@ class RippleDownRules(SubclassJSONSerializer, ABC):
|
|
92
92
|
self.start_rule = start_rule
|
93
93
|
self.fig: Optional[Figure] = None
|
94
94
|
self.viewer: Optional[RDRCaseViewer] = viewer
|
95
|
-
if
|
96
|
-
|
95
|
+
if viewer is None:
|
96
|
+
if len(RDRCaseViewer.instances) > 0:
|
97
|
+
self.viewer = RDRCaseViewer.instances[0]
|
98
|
+
logger.error("No viewer was provided, but there is already an existing viewer. "
|
99
|
+
"Using the existing viewer.")
|
100
|
+
|
101
|
+
@property
|
102
|
+
def viewer(self):
|
103
|
+
return self._viewer
|
104
|
+
|
105
|
+
@viewer.setter
|
106
|
+
def viewer(self, value):
|
107
|
+
self._viewer = value
|
108
|
+
if value is not None:
|
109
|
+
value.set_save_function(self.save)
|
97
110
|
|
98
111
|
def save(self, save_dir: Optional[str] = None, model_name: Optional[str] = None,
|
99
112
|
package_name: Optional[str] = None) -> str:
|
@@ -33,7 +33,7 @@ class RDRDecorator:
|
|
33
33
|
viewer: Optional[RDRCaseViewer] = None,
|
34
34
|
package_name: Optional[str] = None,
|
35
35
|
use_generated_classifier: bool = False,
|
36
|
-
ask_now: Callable[[
|
36
|
+
ask_now: Callable[Dict[str, Any], bool] = lambda _: True,
|
37
37
|
fitting_decorator: Optional[Callable] = None):
|
38
38
|
"""
|
39
39
|
:param models_dir: The directory to save/load the RDR models.
|
@@ -99,7 +99,7 @@ class RDRDecorator:
|
|
99
99
|
viewer=self.viewer)
|
100
100
|
return output
|
101
101
|
|
102
|
-
if self.fit and not self.use_generated_classifier and self.ask_now(case_dict
|
102
|
+
if self.fit and not self.use_generated_classifier and self.ask_now(case_dict):
|
103
103
|
output = fit()
|
104
104
|
else:
|
105
105
|
if self.use_generated_classifier:
|
@@ -167,6 +167,7 @@ class RDRDecorator:
|
|
167
167
|
return Case(dict, id(case_dict), case_name, case_dict, **case_dict), case_dict
|
168
168
|
|
169
169
|
def initialize_rdr_model_name_and_load(self, func: Callable) -> None:
|
170
|
+
self.viewer = RDRCaseViewer.instances[0] if len(RDRCaseViewer.instances) > 0 else self.viewer
|
170
171
|
model_file_name = get_func_rdr_model_name(func, include_file_name=True)
|
171
172
|
self.model_name = str_to_snake_case(model_file_name)
|
172
173
|
self.load()
|
@@ -201,10 +202,8 @@ class RDRDecorator:
|
|
201
202
|
model_path = os.path.join(self.rdr_models_dir, self.model_name + f"/rdr_metadata/{self.model_name}.json")
|
202
203
|
if os.path.exists(os.path.join(self.rdr_models_dir, model_path)):
|
203
204
|
self.rdr = GeneralRDR.load(self.rdr_models_dir, self.model_name, package_name=self.package_name)
|
204
|
-
self.rdr.set_viewer(self.viewer)
|
205
205
|
if self.rdr is None:
|
206
|
-
self.rdr = GeneralRDR(save_dir=self.rdr_models_dir, model_name=self.model_name
|
207
|
-
viewer=self.viewer)
|
206
|
+
self.rdr = GeneralRDR(save_dir=self.rdr_models_dir, model_name=self.model_name)
|
208
207
|
|
209
208
|
def update_from_python(self):
|
210
209
|
"""
|
@@ -282,11 +282,14 @@ class RDRCaseViewer(QMainWindow):
|
|
282
282
|
user_input: Optional[str] = None
|
283
283
|
attributes_widget: Optional[QWidget] = None
|
284
284
|
save_function: Optional[Callable[str, str], None] = None
|
285
|
+
instances: List[RDRCaseViewer] = []
|
285
286
|
|
286
287
|
def __init__(self, parent=None,
|
287
288
|
save_dir: Optional[str] = None,
|
288
289
|
save_model_name: Optional[str] = None):
|
289
290
|
super().__init__(parent)
|
291
|
+
self.instances.clear()
|
292
|
+
self.instances.append(self)
|
290
293
|
self.save_dir = save_dir
|
291
294
|
self.save_model_name = save_model_name
|
292
295
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ripple_down_rules
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.14
|
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
|
License: GNU GENERAL PUBLIC LICENSE
|
@@ -1,8 +1,8 @@
|
|
1
|
-
ripple_down_rules/__init__.py,sha256=
|
1
|
+
ripple_down_rules/__init__.py,sha256=K_u_cwcMMPTstWbeVPYK6ibSHNdps5WcwSGTSimjTiE,100
|
2
2
|
ripple_down_rules/experts.py,sha256=4-dMIVeMzFXCLYl_XBG_P7_Xs4sZih9-vZxCIPri6dA,12958
|
3
|
-
ripple_down_rules/helpers.py,sha256=
|
4
|
-
ripple_down_rules/rdr.py,sha256=
|
5
|
-
ripple_down_rules/rdr_decorators.py,sha256=
|
3
|
+
ripple_down_rules/helpers.py,sha256=X-pYuCsmuNraUFcIL450AsaOdGvGjotNPgSx8yu3NMg,4525
|
4
|
+
ripple_down_rules/rdr.py,sha256=x19ElNV-v67XkbSVLg9lp0xwo6PRNebBJa6dJSFCqhU,56755
|
5
|
+
ripple_down_rules/rdr_decorators.py,sha256=zeDVGVSIRGnXLB2kmnZ2DXP7sF6RAH8tXaDoDY_QFWQ,10608
|
6
6
|
ripple_down_rules/rules.py,sha256=Dk4yGCy5oV10mOv5rRLcmtIu9J60WBPol9b7ELFn6fY,21522
|
7
7
|
ripple_down_rules/start-code-server.sh,sha256=otClk7VmDgBOX2TS_cjws6K0UwvgAUJhoA0ugkPCLqQ,949
|
8
8
|
ripple_down_rules/utils.py,sha256=vFoz5HcRgkf7_s-zdWSg54xI9PCMcdDzcdFGdas7KBA,62350
|
@@ -12,13 +12,13 @@ ripple_down_rules/datastructures/case.py,sha256=PJ7_-AdxYic6BO5z816piFODj6nU5J6J
|
|
12
12
|
ripple_down_rules/datastructures/dataclasses.py,sha256=D-nrVEW_27njmDGkyiHRnq5lmqEdO8RHKnLb1mdnwrA,11054
|
13
13
|
ripple_down_rules/datastructures/enums.py,sha256=ce7tqS0otfSTNAOwsnXlhsvIn4iW_Y_N3TNebF3YoZs,5700
|
14
14
|
ripple_down_rules/user_interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
|
-
ripple_down_rules/user_interface/gui.py,sha256=
|
15
|
+
ripple_down_rules/user_interface/gui.py,sha256=druufu9cVeVUajPW-RqGW3ZiEbgdgNBQD2CLhadQo18,27486
|
16
16
|
ripple_down_rules/user_interface/ipython_custom_shell.py,sha256=yp-F8YRWGhj1PLB33HE6vJkdYWFN5Zn2244S2DUWRTM,6576
|
17
17
|
ripple_down_rules/user_interface/object_diagram.py,sha256=FEa2HaYR9QmTE6NsOwBvZ0jqmu3DKyg6mig2VE5ZP4Y,4956
|
18
18
|
ripple_down_rules/user_interface/prompt.py,sha256=JceEUGYsd0lIvd-v2y3D3swoo96_C0lxfp3CxM7Vfts,8900
|
19
19
|
ripple_down_rules/user_interface/template_file_creator.py,sha256=kwBbFLyN6Yx2NTIHPSwOoytWgbJDYhgrUOVFw_jkDQ4,13522
|
20
|
-
ripple_down_rules-0.6.
|
21
|
-
ripple_down_rules-0.6.
|
22
|
-
ripple_down_rules-0.6.
|
23
|
-
ripple_down_rules-0.6.
|
24
|
-
ripple_down_rules-0.6.
|
20
|
+
ripple_down_rules-0.6.14.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
|
21
|
+
ripple_down_rules-0.6.14.dist-info/METADATA,sha256=fiq0Jj43sSuWmfUtVfaKScjdcokmDDzxH-XHNUIxXc0,48214
|
22
|
+
ripple_down_rules-0.6.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
ripple_down_rules-0.6.14.dist-info/top_level.txt,sha256=VeoLhEhyK46M1OHwoPbCQLI1EifLjChqGzhQ6WEUqeM,18
|
24
|
+
ripple_down_rules-0.6.14.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|