pyeggp 1.0.0__cp313-cp313-macosx_14_0_x86_64.whl → 1.0.2__cp313-cp313-macosx_14_0_x86_64.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.
- pyeggp/__init__.py +41 -1
- pyeggp/_binding.cpython-313-darwin.so +0 -0
- {pyeggp-1.0.0.dist-info → pyeggp-1.0.2.dist-info}/METADATA +1 -1
- {pyeggp-1.0.0.dist-info → pyeggp-1.0.2.dist-info}/RECORD +8 -8
- {pyeggp-1.0.0.dist-info → pyeggp-1.0.2.dist-info}/WHEEL +0 -0
- {pyeggp-1.0.0.dist-info → pyeggp-1.0.2.dist-info}/entry_points.txt +0 -0
- {pyeggp-1.0.0.dist-info → pyeggp-1.0.2.dist-info}/licenses/LICENSE +0 -0
- {pyeggp-1.0.0.dist-info → pyeggp-1.0.2.dist-info}/top_level.txt +0 -0
pyeggp/__init__.py
CHANGED
@@ -96,14 +96,54 @@ class PyEGGP(BaseEstimator, RegressorMixin):
|
|
96
96
|
self.is_fitted_ = True
|
97
97
|
return self
|
98
98
|
|
99
|
+
def fit_mvsr(self, Xs, ys):
|
100
|
+
if Xs[0].ndim == 1:
|
101
|
+
Xs = [X.reshape(-1,1) for X in Xs]
|
102
|
+
ys = [y.reshape(-1, 1) for y in ys]
|
103
|
+
combineds = [np.hstack([X, y]) for X, y in zip(Xs, ys)]
|
104
|
+
header = [f"x{i}" for i in range(Xs[0].shape[1])] + ["y"]
|
105
|
+
datasets = []
|
106
|
+
for combined in combineds:
|
107
|
+
with tempfile.NamedTemporaryFile(mode='w+', newline='', delete=False, suffix='.csv') as temp_file:
|
108
|
+
writer = csv.writer(temp_file)
|
109
|
+
writer.writerow(header)
|
110
|
+
writer.writerows(combined)
|
111
|
+
datasets.append(temp_file.name)
|
112
|
+
|
113
|
+
csv_data = pyeggp_run(" ".join(datasets), self.gen, self.nPop, self.maxSize, self.nTournament, self.pc, self.pm, self.nonterminals, self.loss, self.optIter, self.optRepeat, self.nParams, self.split, self.simplify, self.dumpTo, self.loadFrom)
|
114
|
+
if len(csv_data) > 0:
|
115
|
+
csv_io = StringIO(csv_data.strip())
|
116
|
+
self.results = pd.read_csv(csv_io, header=0, dtype={'theta':str})
|
117
|
+
self.is_fitted_ = True
|
118
|
+
return self
|
119
|
+
|
99
120
|
def predict(self, X):
|
100
121
|
check_is_fitted(self)
|
101
|
-
return self.evaluate_best_model(
|
122
|
+
return self.evaluate_best_model(X)
|
123
|
+
|
124
|
+
def predict_mvsr(self, X, view):
|
125
|
+
check_is_fitted(self)
|
126
|
+
return self.evaluate_best_model_view(X, view)
|
127
|
+
|
102
128
|
def evaluate_best_model(self, x):
|
103
129
|
if x.ndim == 1:
|
104
130
|
x = x.reshape(-1,1)
|
105
131
|
t = np.array(list(map(float, self.results.iloc[-1].theta.split(";"))))
|
106
132
|
return eval(self.results.iloc[-1].Numpy)
|
133
|
+
def evaluate_best_model_view(self, x, view):
|
134
|
+
if x.ndim == 1:
|
135
|
+
x = x.reshape(-1,1)
|
136
|
+
ix = self.results.iloc[-1].id
|
137
|
+
best = self.results[self.results.id==ix].iloc[view]
|
138
|
+
t = np.array(list(map(float, best.theta.split(";"))))
|
139
|
+
return eval(best.Numpy)
|
140
|
+
|
141
|
+
def evaluate_model_view(self, x, ix, view):
|
142
|
+
if x.ndim == 1:
|
143
|
+
x = x.reshape(-1,1)
|
144
|
+
best = self.results[self.results.id==ix].iloc[view]
|
145
|
+
t = np.array(list(map(float, best.theta.split(";"))))
|
146
|
+
return eval(best.Numpy)
|
107
147
|
def evaluate_model(self, ix, x):
|
108
148
|
if x.ndim == 1:
|
109
149
|
x = x.reshape(-1,1)
|
Binary file
|
@@ -1,5 +1,5 @@
|
|
1
|
-
pyeggp/_binding.cpython-313-darwin.so,sha256=
|
2
|
-
pyeggp/__init__.py,sha256=
|
1
|
+
pyeggp/_binding.cpython-313-darwin.so,sha256=XwcSqaF3K13Jhlp16QY871cuO8xfPplV4WA0SmUX91I,55148496
|
2
|
+
pyeggp/__init__.py,sha256=ag29g10K_goyZDXVPc-QeT5M332KN1mddYZ-FaEGlgQ,5775
|
3
3
|
pyeggp/_binding.pyi,sha256=TsI8Gar1wpDs3c8V26i3w_u1JjznlE5dReV59bbVUh0,460
|
4
4
|
pyeggp/binding.i,sha256=AdPEymjqByW6OhpJS08o2oTc7Go3-274JqRhbXoyDjg,1908
|
5
5
|
pyeggp/_binding.py,sha256=09jtEOIompJDcOCr15qBoxdG6d1lumzonxlTYXsW3b4,580
|
@@ -7,9 +7,9 @@ pyeggp/typing.py,sha256=qr1vWstl5HiaUT5HGsQFHO4pRq4EhqEc4zG2mn9QHgc,517
|
|
7
7
|
pyeggp/binding.py,sha256=8PjUmL-TO2k9M1uUdT8hriWKUdTUfqMgXnpcwWklayk,2625
|
8
8
|
pyeggp/__main__.py,sha256=dAMEebAw-mVcR5PUffuRsUDPFm6Vf4qvaam9TPSUs0I,155
|
9
9
|
pyeggp/.dylibs/libnlopt.1.0.0.dylib,sha256=KLCzh-73JgicfAN8r0WwrJmSXeKsu498GZ1uTQiUu6g,480064
|
10
|
-
pyeggp-1.0.
|
11
|
-
pyeggp-1.0.
|
12
|
-
pyeggp-1.0.
|
13
|
-
pyeggp-1.0.
|
14
|
-
pyeggp-1.0.
|
15
|
-
pyeggp-1.0.
|
10
|
+
pyeggp-1.0.2.dist-info/RECORD,,
|
11
|
+
pyeggp-1.0.2.dist-info/WHEEL,sha256=JaYLvkvPz-qz2mflQGdb_ZpVrX6HdMy1uY7bprVCP_Y,110
|
12
|
+
pyeggp-1.0.2.dist-info/entry_points.txt,sha256=NJouaQ2UoCLBu7Toqer0FBvNSDYMawR_Wx9STMdopyY,48
|
13
|
+
pyeggp-1.0.2.dist-info/top_level.txt,sha256=iLrWfWZHh4NruYDgVyn2ntEB-uJ8fIs95nzNVLIhKE4,7
|
14
|
+
pyeggp-1.0.2.dist-info/METADATA,sha256=ezRmsnPEc0Uc8Coi_5xX08en30lyJdV0PKk8gT2njvc,42220
|
15
|
+
pyeggp-1.0.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|