psyke 0.10.1.dev11__py3-none-any.whl → 0.10.2.dev10__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.
Potentially problematic release.
This version of psyke might be problematic. Click here for more details.
- psyke/genetic/gin/__init__.py +14 -7
- {psyke-0.10.1.dev11.dist-info → psyke-0.10.2.dev10.dist-info}/METADATA +1 -1
- {psyke-0.10.1.dev11.dist-info → psyke-0.10.2.dev10.dist-info}/RECORD +6 -6
- {psyke-0.10.1.dev11.dist-info → psyke-0.10.2.dev10.dist-info}/WHEEL +0 -0
- {psyke-0.10.1.dev11.dist-info → psyke-0.10.2.dev10.dist-info}/licenses/LICENSE +0 -0
- {psyke-0.10.1.dev11.dist-info → psyke-0.10.2.dev10.dist-info}/top_level.txt +0 -0
psyke/genetic/gin/__init__.py
CHANGED
|
@@ -32,6 +32,7 @@ class GIn:
|
|
|
32
32
|
self.toolbox = None
|
|
33
33
|
self.stats = None
|
|
34
34
|
self.hof = None
|
|
35
|
+
self.best = None
|
|
35
36
|
|
|
36
37
|
self.setup(warm)
|
|
37
38
|
|
|
@@ -70,8 +71,11 @@ class GIn:
|
|
|
70
71
|
return accuracy_score(true, pred)
|
|
71
72
|
raise NameError('Supported metrics are R2, MAE, MSE, F1, ACC')
|
|
72
73
|
|
|
73
|
-
def
|
|
74
|
-
|
|
74
|
+
def predict(self, to_pred):
|
|
75
|
+
return self.__predict(to_pred=to_pred)[0]
|
|
76
|
+
|
|
77
|
+
def __predict(self, individual=None, to_pred=None):
|
|
78
|
+
individual = individual or self.best
|
|
75
79
|
boundaries = np.cumsum([0] + list(self.slices))
|
|
76
80
|
cuts = [sorted(individual[boundaries[i]:boundaries[i + 1]]) for i in range(len(self.slices))]
|
|
77
81
|
|
|
@@ -79,7 +83,7 @@ class GIn:
|
|
|
79
83
|
regionsT = self.region(self.X, cuts)
|
|
80
84
|
|
|
81
85
|
y_pred = np.empty(len(to_pred), dtype=f'U{self.y.str.len().max()}') if self.output == Target.CLASSIFICATION \
|
|
82
|
-
else np.
|
|
86
|
+
else np.zeros(len(to_pred))
|
|
83
87
|
valid_regions = 0
|
|
84
88
|
|
|
85
89
|
for r in range(np.prod([s + 1 for s in self.slices])):
|
|
@@ -92,10 +96,13 @@ class GIn:
|
|
|
92
96
|
y_pred[mask] = self.__output_estimation(maskT, to_pred[mask])
|
|
93
97
|
valid_regions += 1
|
|
94
98
|
|
|
99
|
+
return y_pred, valid_regions
|
|
100
|
+
|
|
101
|
+
def evaluate(self, individual=None):
|
|
102
|
+
y_pred, valid_regions = self.__predict(individual or self.best, self.X if self.valid is None else self.valid[0])
|
|
95
103
|
if valid_regions < self.min_rules:
|
|
96
104
|
return -9999,
|
|
97
|
-
|
|
98
|
-
return self.__score(true, y_pred),
|
|
105
|
+
return self.__score(self.y if self.valid is None else self.valid[1], y_pred),
|
|
99
106
|
|
|
100
107
|
def setup(self, warm=False):
|
|
101
108
|
if not warm:
|
|
@@ -131,5 +138,5 @@ class GIn:
|
|
|
131
138
|
pop = self.toolbox.population(n=n_pop)
|
|
132
139
|
result, log = algorithms.eaSimple(pop, self.toolbox, cxpb=cxpb, mutpb=mutpb, ngen=n_gen,
|
|
133
140
|
stats=self.stats, halloffame=self.hof, verbose=False)
|
|
134
|
-
best = tools.selBest(pop, 1)[0]
|
|
135
|
-
return best, self.evaluate(
|
|
141
|
+
self.best = tools.selBest(pop, 1)[0]
|
|
142
|
+
return self.best, self.evaluate()[0], result, log
|
|
@@ -26,7 +26,7 @@ psyke/extraction/real/utils.py,sha256=4NNL15Eu7cmkG9b29GBP6CKgMTV1cmiJVS0k1MbWpI
|
|
|
26
26
|
psyke/extraction/trepan/__init__.py,sha256=H8F_wpFLPcfyx2tgOOno8FwUomxfVxVl1vxlb0ClP1g,6931
|
|
27
27
|
psyke/extraction/trepan/utils.py,sha256=iSUJ1ooNQT_VO1KfBZuIUeUsyUbGdQf_pSEE87vMeQg,2320
|
|
28
28
|
psyke/genetic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
|
-
psyke/genetic/gin/__init__.py,sha256=
|
|
29
|
+
psyke/genetic/gin/__init__.py,sha256=svO8hwklJ96ZuMiB0qbwBH1B096HvymP5llVt0ntSow,5772
|
|
30
30
|
psyke/schema/__init__.py,sha256=axv4ejZY0ItUwrC9IXb_yAhaQL5f1vwvXXmaIAHJmt0,26063
|
|
31
31
|
psyke/tuning/__init__.py,sha256=yd_ForFmHeYbtRXltY1fOa-mPJvpE6ijzg50M_8Sdxw,3649
|
|
32
32
|
psyke/tuning/crash/__init__.py,sha256=zIHEF75EFy_mRIieqzP04qKLG3GLsSc_mYZHpPfkzxU,2623
|
|
@@ -38,8 +38,8 @@ psyke/utils/logic.py,sha256=ioP25WMTYNYEzaRDNDe3kGNWqZ6DA_63t19d-ky_2kM,12227
|
|
|
38
38
|
psyke/utils/metrics.py,sha256=Oo5BOonOSfo0qYsXWT5dmypZ7jiStByFC2MKEU0uMHg,2250
|
|
39
39
|
psyke/utils/plot.py,sha256=dE8JJ6tQ0Ezosid-r2jqAisREjFe5LqExRzsVi5Ns-c,7785
|
|
40
40
|
psyke/utils/sorted.py,sha256=C3CPW2JisND30BRk5c1sAAHs3Lb_wsRB2qZrYFuRnfM,678
|
|
41
|
-
psyke-0.10.
|
|
42
|
-
psyke-0.10.
|
|
43
|
-
psyke-0.10.
|
|
44
|
-
psyke-0.10.
|
|
45
|
-
psyke-0.10.
|
|
41
|
+
psyke-0.10.2.dev10.dist-info/licenses/LICENSE,sha256=G3mPaubObvkBXbsgTTeYGLk_pNEW8tc7HZr4u_wLEpU,11398
|
|
42
|
+
psyke-0.10.2.dev10.dist-info/METADATA,sha256=DOa6rC0lTAZje50Bq2h_za8XPa1etUCy2zI6qDynPxE,8396
|
|
43
|
+
psyke-0.10.2.dev10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
44
|
+
psyke-0.10.2.dev10.dist-info/top_level.txt,sha256=q1HglxOqqoIRukFtyis_ZNHczZg4gANRUPWkD7HAUTU,6
|
|
45
|
+
psyke-0.10.2.dev10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|