pyeggp 1.0.0__cp310-cp310-macosx_14_0_arm64.whl → 1.0.1__cp310-cp310-macosx_14_0_arm64.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 CHANGED
@@ -96,14 +96,53 @@ 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(self.model_, X)
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
+ def evaluate_model_view(self, x, ix, view):
141
+ if x.ndim == 1:
142
+ x = x.reshape(-1,1)
143
+ best = self.results[self.results.id==ix].iloc[view]
144
+ t = np.array(list(map(float, best.theta.split(";"))))
145
+ return eval(best.Numpy)
107
146
  def evaluate_model(self, ix, x):
108
147
  if x.ndim == 1:
109
148
  x = x.reshape(-1,1)
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyeggp
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Python Wheels for eggp algorithm.
5
5
  Author-email: Fabricio Olivetti <folivetti@users.noreply.github.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -1,15 +1,15 @@
1
- pyeggp/__init__.py,sha256=S4KjoS28x9S5Zle2kLt_RCZ92WY2PZN5WsoWu095llc,4019
1
+ pyeggp-1.0.1.dist-info/RECORD,,
2
+ pyeggp-1.0.1.dist-info/WHEEL,sha256=Fvphz92IRlGJZ3kKS7pknSosU5_kkb5AV_S3x4jC_J8,109
3
+ pyeggp-1.0.1.dist-info/entry_points.txt,sha256=NJouaQ2UoCLBu7Toqer0FBvNSDYMawR_Wx9STMdopyY,48
4
+ pyeggp-1.0.1.dist-info/top_level.txt,sha256=iLrWfWZHh4NruYDgVyn2ntEB-uJ8fIs95nzNVLIhKE4,7
5
+ pyeggp-1.0.1.dist-info/METADATA,sha256=vbigkLKhJ_sSORsiKsZkFnU-Mjs8jOSN4Rj7gypQbtU,42220
6
+ pyeggp-1.0.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
7
+ pyeggp/__init__.py,sha256=rzgGMRTJwRU0BDhfUCcE1G0OvFwu3o0qcjTfTRV7q54,5774
2
8
  pyeggp/_binding.pyi,sha256=TsI8Gar1wpDs3c8V26i3w_u1JjznlE5dReV59bbVUh0,460
3
- pyeggp/_binding.cpython-310-darwin.so,sha256=7qRJbrhy9bU0CZ-6gaKS7nw7kjh0oSludOOwhW6pI7k,48557936
9
+ pyeggp/_binding.cpython-310-darwin.so,sha256=FNuWocHw2MWu87hIXP5_-P-mR5YUeyzW0x_pNlFLijc,48557936
4
10
  pyeggp/binding.i,sha256=AdPEymjqByW6OhpJS08o2oTc7Go3-274JqRhbXoyDjg,1908
5
11
  pyeggp/_binding.py,sha256=a7A4MeQiCK6iVq0LIiGUiD_b0Kw7Qj8MMVTBA4f25zc,580
6
12
  pyeggp/typing.py,sha256=qr1vWstl5HiaUT5HGsQFHO4pRq4EhqEc4zG2mn9QHgc,517
7
13
  pyeggp/binding.py,sha256=8PjUmL-TO2k9M1uUdT8hriWKUdTUfqMgXnpcwWklayk,2625
8
14
  pyeggp/__main__.py,sha256=dAMEebAw-mVcR5PUffuRsUDPFm6Vf4qvaam9TPSUs0I,155
9
15
  pyeggp/.dylibs/libnlopt.1.0.0.dylib,sha256=Tq5lixYXekOwOCwz3yxVXUsAQkMn8whIbV4f1qK2rFA,447840
10
- pyeggp-1.0.0.dist-info/RECORD,,
11
- pyeggp-1.0.0.dist-info/WHEEL,sha256=Fvphz92IRlGJZ3kKS7pknSosU5_kkb5AV_S3x4jC_J8,109
12
- pyeggp-1.0.0.dist-info/entry_points.txt,sha256=NJouaQ2UoCLBu7Toqer0FBvNSDYMawR_Wx9STMdopyY,48
13
- pyeggp-1.0.0.dist-info/top_level.txt,sha256=iLrWfWZHh4NruYDgVyn2ntEB-uJ8fIs95nzNVLIhKE4,7
14
- pyeggp-1.0.0.dist-info/METADATA,sha256=4z00OKGfxeNOFYIrfF4bipPgArl2otXNGJaKpDudor0,42220
15
- pyeggp-1.0.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
File without changes