psyke 0.8.2.dev1__tar.gz → 0.8.2.dev4__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.
Potentially problematic release.
This version of psyke might be problematic. Click here for more details.
- {psyke-0.8.2.dev1/psyke.egg-info → psyke-0.8.2.dev4}/PKG-INFO +1 -1
- psyke-0.8.2.dev4/VERSION +1 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/hypercubic/__init__.py +9 -20
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/hypercubic/creepy/__init__.py +1 -6
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/hypercubic/gridex/__init__.py +2 -1
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/hypercubic/hypercube.py +26 -20
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/hypercubepredictor.py +9 -2
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4/psyke.egg-info}/PKG-INFO +1 -1
- psyke-0.8.2.dev1/VERSION +0 -1
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/LICENSE +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/MANIFEST.in +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/README.md +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/clustering/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/clustering/cream/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/clustering/exact/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/clustering/utils.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/cart/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/cart/predictor.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/hypercubic/cosmik/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/hypercubic/divine/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/hypercubic/gridrex/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/hypercubic/hex/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/hypercubic/iter/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/hypercubic/strategy.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/hypercubic/utils.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/real/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/real/utils.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/trepan/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/extraction/trepan/utils.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/schema/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/tuning/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/tuning/crash/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/tuning/orchid/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/tuning/pedro/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/utils/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/utils/dataframe.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/utils/logic.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/utils/metrics.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/utils/plot.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke/utils/sorted.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke.egg-info/SOURCES.txt +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke.egg-info/dependency_links.txt +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke.egg-info/not-zip-safe +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke.egg-info/requires.txt +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/psyke.egg-info/top_level.txt +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/pyproject.toml +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/setup.cfg +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/setup.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/clustering/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/cart/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/cart/test_cart.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/cart/test_simplified_cart.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/hypercubic/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/hypercubic/gridex/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/hypercubic/gridex/test_gridex.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/hypercubic/iter/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/hypercubic/iter/test_iter.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/hypercubic/test_hypercube.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/real/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/real/test_real.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/real/test_rule.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/trepan/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/trepan/test_node.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/trepan/test_split.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/trepan/test_trepan.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/utils/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/utils/test_prune.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/utils/test_simplify.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/utils/test_simplify_formatter.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/resources/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/resources/datasets/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/resources/predictors/__init__.py +0 -0
- {psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/resources/tests/__init__.py +0 -0
psyke-0.8.2.dev4/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.8.2.dev4
|
|
@@ -40,16 +40,6 @@ class HyperCubeExtractor(HyperCubePredictor, PedagogicalExtractor, ABC):
|
|
|
40
40
|
cubes.sort()
|
|
41
41
|
self._hypercubes = [cube[2] for cube in cubes]
|
|
42
42
|
|
|
43
|
-
def _last_cube_as_default(self, theory):
|
|
44
|
-
last_clause = list(theory.clauses)[-1]
|
|
45
|
-
theory.retract(last_clause)
|
|
46
|
-
theory.assertZ(clause(
|
|
47
|
-
last_clause.head, [last_in_body(last_clause.body)] if self._output is Target.REGRESSION else []))
|
|
48
|
-
last_cube = self._hypercubes[-1]
|
|
49
|
-
for dimension in last_cube.dimensions.keys():
|
|
50
|
-
last_cube[dimension] = [-np.inf, np.inf]
|
|
51
|
-
return theory
|
|
52
|
-
|
|
53
43
|
def extract(self, dataframe: pd.DataFrame) -> Theory:
|
|
54
44
|
theory = PedagogicalExtractor.extract(self, dataframe)
|
|
55
45
|
self._surrounding = HyperCube.create_surrounding_cube(dataframe, output=self._output)
|
|
@@ -57,7 +47,7 @@ class HyperCubeExtractor(HyperCubePredictor, PedagogicalExtractor, ABC):
|
|
|
57
47
|
return theory
|
|
58
48
|
|
|
59
49
|
def predict_counter(self, data: dict[str, float]):
|
|
60
|
-
cube = self._find_cube(data)
|
|
50
|
+
cube = self._find_cube(data.copy())
|
|
61
51
|
if cube is None:
|
|
62
52
|
print("The extracted knowledge is not exhaustive; impossible to predict this instance")
|
|
63
53
|
else:
|
|
@@ -72,7 +62,7 @@ class HyperCubeExtractor(HyperCubePredictor, PedagogicalExtractor, ABC):
|
|
|
72
62
|
outputs.append(c.output)
|
|
73
63
|
print("The output may be", c.output, 'if')
|
|
74
64
|
|
|
75
|
-
for d in
|
|
65
|
+
for d in point.dimensions.keys():
|
|
76
66
|
lower, upper = c[d]
|
|
77
67
|
p = point[d]
|
|
78
68
|
if p < lower:
|
|
@@ -91,14 +81,14 @@ class HyperCubeExtractor(HyperCubePredictor, PedagogicalExtractor, ABC):
|
|
|
91
81
|
return conditions
|
|
92
82
|
|
|
93
83
|
def predict_why(self, data: dict[str, float]):
|
|
94
|
-
cube = self._find_cube(data)
|
|
84
|
+
cube = self._find_cube(data.copy())
|
|
95
85
|
if cube is None:
|
|
96
86
|
print("The extracted knowledge is not exhaustive; impossible to predict this instance")
|
|
97
87
|
else:
|
|
98
88
|
output = self._predict_from_cubes(data)
|
|
99
89
|
print(f"The output is {output} because")
|
|
100
90
|
conditions = self.__get_local_conditions(cube)
|
|
101
|
-
for d in
|
|
91
|
+
for d in data.keys():
|
|
102
92
|
simplified = HyperCubeExtractor.__simplify(conditions[d])
|
|
103
93
|
for i, condition in enumerate(simplified):
|
|
104
94
|
if i == 0:
|
|
@@ -149,14 +139,14 @@ class HyperCubeExtractor(HyperCubePredictor, PedagogicalExtractor, ABC):
|
|
|
149
139
|
if not isinstance(output, LinearRegression) else \
|
|
150
140
|
create_head(dataframe.columns[-1], variables[:-1], variables[-1])
|
|
151
141
|
|
|
152
|
-
def _ignore_dimensions(self, cube: HyperCube) -> Iterable[str]:
|
|
153
|
-
return [d for d in cube.dimensions if cube[d][0] == -np.inf or cube[d][1] == np.inf]
|
|
154
|
-
|
|
155
142
|
def __drop(self, dataframe: pd.DataFrame):
|
|
156
143
|
self._hypercubes = [cube for cube in self._hypercubes if cube.count(dataframe) > 1]
|
|
157
144
|
|
|
158
145
|
def _create_theory(self, dataframe: pd.DataFrame) -> Theory:
|
|
159
146
|
self.__drop(dataframe)
|
|
147
|
+
if self._default_surrounding_cube:
|
|
148
|
+
self._hypercubes[-1].set_default()
|
|
149
|
+
|
|
160
150
|
new_theory = mutable_theory()
|
|
161
151
|
for cube in self._hypercubes:
|
|
162
152
|
logger.info(cube.output)
|
|
@@ -165,10 +155,9 @@ class HyperCubeExtractor(HyperCubePredictor, PedagogicalExtractor, ABC):
|
|
|
165
155
|
variables[dataframe.columns[-1]] = to_var(dataframe.columns[-1])
|
|
166
156
|
head = HyperCubeExtractor._create_head(dataframe, list(variables.values()),
|
|
167
157
|
self.unscale(cube.output, dataframe.columns[-1]))
|
|
168
|
-
body = cube.body(variables, self.
|
|
158
|
+
body = cube.body(variables, self._dimensions_to_ignore, self.unscale, self.normalization)
|
|
169
159
|
new_theory.assertZ(clause(head, body))
|
|
170
|
-
|
|
171
|
-
return self._last_cube_as_default(new_theory) if self._default_surrounding_cube else new_theory
|
|
160
|
+
return HyperCubeExtractor._prettify_theory(new_theory)
|
|
172
161
|
|
|
173
162
|
@staticmethod
|
|
174
163
|
def _prettify_theory(theory: Theory) -> Theory:
|
|
@@ -24,9 +24,8 @@ class CReEPy(HyperCubeExtractor):
|
|
|
24
24
|
discretization, normalization)
|
|
25
25
|
self.clustering = clustering(depth, error_threshold, self._output, gauss_components, discretization,
|
|
26
26
|
normalization, seed)
|
|
27
|
-
self.ranks = ranks
|
|
28
|
-
self.ignore_threshold = ignore_threshold
|
|
29
27
|
self._default_surrounding_cube = True
|
|
28
|
+
self._dimensions_to_ignore = [dimension for dimension, relevance in ranks if relevance < ignore_threshold]
|
|
30
29
|
|
|
31
30
|
def _extract(self, dataframe: pd.DataFrame) -> Theory:
|
|
32
31
|
if not isinstance(self.clustering, HyperCubeClustering):
|
|
@@ -34,8 +33,4 @@ class CReEPy(HyperCubeExtractor):
|
|
|
34
33
|
|
|
35
34
|
self.clustering.fit(dataframe)
|
|
36
35
|
self._hypercubes = self.clustering.get_hypercubes()
|
|
37
|
-
for cube in self._hypercubes:
|
|
38
|
-
for dimension, relevance in self.ranks:
|
|
39
|
-
if relevance < self.ignore_threshold:
|
|
40
|
-
cube[dimension] = [-np.inf, np.inf]
|
|
41
36
|
return self._create_theory(dataframe)
|
|
@@ -37,7 +37,8 @@ class GridEx(HyperCubeExtractor):
|
|
|
37
37
|
for (feature, (a, b)) in cube.dimensions.items():
|
|
38
38
|
n_bins = self.grid.get(feature, iteration)
|
|
39
39
|
if n_bins == 1:
|
|
40
|
-
ranges[feature] = [(
|
|
40
|
+
ranges[feature] = [(a, b)]
|
|
41
|
+
self._dimensions_to_ignore.append(feature)
|
|
41
42
|
else:
|
|
42
43
|
size = (b - a) / n_bins
|
|
43
44
|
ranges[feature] = [(a + size * i, a + size * (i + 1)) for i in range(n_bins)]
|
|
@@ -82,6 +82,7 @@ class HyperCube:
|
|
|
82
82
|
self._diversity = 0.0
|
|
83
83
|
self._error = 0.0
|
|
84
84
|
self._barycenter = Point([], [])
|
|
85
|
+
self._default = False
|
|
85
86
|
|
|
86
87
|
def __contains__(self, obj: dict[str, float] | HyperCube) -> bool:
|
|
87
88
|
"""
|
|
@@ -116,6 +117,13 @@ class HyperCube:
|
|
|
116
117
|
result = [hash(name + str(dimension[0]) + str(dimension[1])) for name, dimension in self.dimensions.items()]
|
|
117
118
|
return sum(result)
|
|
118
119
|
|
|
120
|
+
@property
|
|
121
|
+
def is_default(self) -> bool:
|
|
122
|
+
return self._default
|
|
123
|
+
|
|
124
|
+
def set_default(self):
|
|
125
|
+
self._default = True
|
|
126
|
+
|
|
119
127
|
@property
|
|
120
128
|
def dimensions(self) -> Dimensions:
|
|
121
129
|
return self._dimensions
|
|
@@ -212,12 +220,8 @@ class HyperCube:
|
|
|
212
220
|
|
|
213
221
|
def body(self, variables: dict[str, Var], ignore: list[str], unscale=None, normalization=None) -> Iterable[Struct]:
|
|
214
222
|
dimensions = dict(self.dimensions)
|
|
215
|
-
# TODO: there is something strange in the tests here
|
|
216
|
-
# print('search', [name for name in dimensions.keys()], 'in', (variables.keys()))
|
|
217
|
-
for dimension in ignore:
|
|
218
|
-
del dimensions[dimension]
|
|
219
223
|
return [create_term(variables[name], Between(unscale(values[0], name), unscale(values[1], name)))
|
|
220
|
-
for name, values in dimensions.items()]
|
|
224
|
+
for name, values in dimensions.items() if name not in ignore and not self.is_default]
|
|
221
225
|
|
|
222
226
|
@staticmethod
|
|
223
227
|
def create_surrounding_cube(dataset: pd.DataFrame, closed: bool = False,
|
|
@@ -282,10 +286,12 @@ class HyperCube:
|
|
|
282
286
|
return self[feature][1]
|
|
283
287
|
|
|
284
288
|
def has_volume(self) -> bool:
|
|
285
|
-
return all([dimension[1] - dimension[0] > HyperCube.EPSILON for dimension in self._dimensions.values()
|
|
289
|
+
return all([dimension[1] - dimension[0] > HyperCube.EPSILON for dimension in self._dimensions.values()
|
|
290
|
+
if np.isfinite(dimension[0]) and np.isfinite(dimension[1])])
|
|
286
291
|
|
|
287
292
|
def volume(self) -> float:
|
|
288
|
-
return reduce(lambda a, b: a * b, [dimension[1] - dimension[0] for dimension in self._dimensions.values()
|
|
293
|
+
return reduce(lambda a, b: a * b, [dimension[1] - dimension[0] for dimension in self._dimensions.values()
|
|
294
|
+
if np.isfinite(dimension[0]) and np.isfinite(dimension[1])], 1)
|
|
289
295
|
|
|
290
296
|
def diagonal(self) -> float:
|
|
291
297
|
return reduce(
|
|
@@ -304,7 +310,7 @@ class HyperCube:
|
|
|
304
310
|
|
|
305
311
|
def surface_distance(self, point: Point) -> float:
|
|
306
312
|
s = 0
|
|
307
|
-
for d in
|
|
313
|
+
for d in point.dimensions.keys():
|
|
308
314
|
lower, upper = self[d]
|
|
309
315
|
p = point[d]
|
|
310
316
|
if p > upper:
|
|
@@ -409,8 +415,8 @@ class HyperCube:
|
|
|
409
415
|
|
|
410
416
|
|
|
411
417
|
class RegressionCube(HyperCube):
|
|
412
|
-
def __init__(self, dimension: dict[str, tuple] = None):
|
|
413
|
-
super().__init__(dimension=dimension, output=
|
|
418
|
+
def __init__(self, dimension: dict[str, tuple] = None, output=LinearRegression()):
|
|
419
|
+
super().__init__(dimension=dimension, output=output)
|
|
414
420
|
|
|
415
421
|
def update(self, dataset: pd.DataFrame, predictor) -> None:
|
|
416
422
|
filtered = self.filter_dataframe(dataset.iloc[:, :-1])
|
|
@@ -422,7 +428,7 @@ class RegressionCube(HyperCube):
|
|
|
422
428
|
self._barycenter = Point(means.index.values, means.values)
|
|
423
429
|
|
|
424
430
|
def copy(self) -> RegressionCube:
|
|
425
|
-
return RegressionCube(self.dimensions.copy())
|
|
431
|
+
return RegressionCube(self.dimensions.copy(), output=self._output)
|
|
426
432
|
|
|
427
433
|
def body(self, variables: dict[str, Var], ignore: list[str], unscale=None, normalization=None) -> Iterable[Struct]:
|
|
428
434
|
intercept = self.output.intercept_ if normalization is None else unscale(sum(
|
|
@@ -455,8 +461,8 @@ class ClassificationCube(HyperCube):
|
|
|
455
461
|
|
|
456
462
|
|
|
457
463
|
class ClosedCube(HyperCube):
|
|
458
|
-
def __init__(self, dimension: dict[str, tuple] = None):
|
|
459
|
-
super().__init__(dimension=dimension)
|
|
464
|
+
def __init__(self, dimension: dict[str, tuple] = None, output: str | LinearRegression | float = 0.0):
|
|
465
|
+
super().__init__(dimension=dimension, output=output)
|
|
460
466
|
|
|
461
467
|
def __contains__(self, obj: dict[str, float] | ClosedCube) -> bool:
|
|
462
468
|
"""
|
|
@@ -479,23 +485,23 @@ class ClosedCube(HyperCube):
|
|
|
479
485
|
return np.all((v[:, 0] <= ds) & (ds <= v[:, 1]), axis=1)
|
|
480
486
|
|
|
481
487
|
def copy(self) -> ClosedCube:
|
|
482
|
-
return ClosedCube(self.dimensions.copy())
|
|
488
|
+
return ClosedCube(self.dimensions.copy(), output=self._output)
|
|
483
489
|
|
|
484
490
|
|
|
485
491
|
class ClosedRegressionCube(ClosedCube, RegressionCube):
|
|
486
|
-
def __init__(self, dimension: dict[str, tuple] = None):
|
|
487
|
-
super().__init__(dimension=dimension)
|
|
492
|
+
def __init__(self, dimension: dict[str, tuple] = None, output: LinearRegression = LinearRegression()):
|
|
493
|
+
super().__init__(dimension=dimension, output=output)
|
|
488
494
|
|
|
489
495
|
def copy(self) -> ClosedRegressionCube:
|
|
490
|
-
return ClosedRegressionCube(self.dimensions.copy())
|
|
496
|
+
return ClosedRegressionCube(self.dimensions.copy(), output=self._output)
|
|
491
497
|
|
|
492
498
|
|
|
493
499
|
class ClosedClassificationCube(ClosedCube, ClassificationCube):
|
|
494
|
-
def __init__(self, dimension: dict[str, tuple] = None):
|
|
495
|
-
super().__init__(dimension=dimension)
|
|
500
|
+
def __init__(self, dimension: dict[str, tuple] = None, output: str = None):
|
|
501
|
+
super().__init__(dimension=dimension, output=output)
|
|
496
502
|
|
|
497
503
|
def copy(self) -> ClosedClassificationCube:
|
|
498
|
-
return ClosedClassificationCube(self.dimensions.copy())
|
|
504
|
+
return ClosedClassificationCube(self.dimensions.copy(), output=self._output)
|
|
499
505
|
|
|
500
506
|
|
|
501
507
|
GenericCube = Union[HyperCube, ClassificationCube, RegressionCube,
|
|
@@ -14,6 +14,7 @@ class HyperCubePredictor(EvaluableModel):
|
|
|
14
14
|
def __init__(self, output=Target.CONSTANT, discretization=None, normalization=None):
|
|
15
15
|
super().__init__(discretization, normalization)
|
|
16
16
|
self._hypercubes = []
|
|
17
|
+
self._dimensions_to_ignore = []
|
|
17
18
|
self._output = output
|
|
18
19
|
self._surrounding = None
|
|
19
20
|
|
|
@@ -75,10 +76,16 @@ class HyperCubePredictor(EvaluableModel):
|
|
|
75
76
|
return round(HyperCubePredictor._get_cube_output(cube, data), get_int_precision())
|
|
76
77
|
|
|
77
78
|
def _find_cube(self, data: dict[str, float]) -> GenericCube | None:
|
|
79
|
+
for dimension in self._dimensions_to_ignore:
|
|
80
|
+
del data[dimension]
|
|
81
|
+
found = None
|
|
78
82
|
for cube in self._hypercubes:
|
|
79
83
|
if data in cube:
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
found = cube.copy()
|
|
85
|
+
break
|
|
86
|
+
if found is None and self._hypercubes[-1].is_default:
|
|
87
|
+
found = self._hypercubes[-1].copy()
|
|
88
|
+
return found
|
|
82
89
|
|
|
83
90
|
@property
|
|
84
91
|
def n_rules(self):
|
psyke-0.8.2.dev1/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.8.2.dev1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{psyke-0.8.2.dev1 → psyke-0.8.2.dev4}/test/psyke/extraction/hypercubic/gridex/test_gridex.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|