pyeggp 1.0.1__cp39-cp39-win_amd64.whl → 1.0.3__cp39-cp39-win_amd64.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
@@ -10,10 +10,10 @@ def _delvewheel_patch_1_10_0():
10
10
  if os.path.isdir(libs_dir):
11
11
  os.add_dll_directory(libs_dir)
12
12
  else:
13
- load_order_filepath = os.path.join(libs_dir, '.load-order-pyeggp-1.0.1')
13
+ load_order_filepath = os.path.join(libs_dir, '.load-order-pyeggp-1.0.3')
14
14
  if os.path.isfile(load_order_filepath):
15
15
  import ctypes.wintypes
16
- with open(os.path.join(libs_dir, '.load-order-pyeggp-1.0.1')) as file:
16
+ with open(os.path.join(libs_dir, '.load-order-pyeggp-1.0.3')) as file:
17
17
  load_order = file.read().split()
18
18
  kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
19
19
  kernel32.LoadLibraryExW.restype = ctypes.wintypes.HMODULE
@@ -32,6 +32,7 @@ import atexit
32
32
  from contextlib import contextmanager
33
33
  from threading import Lock
34
34
  from typing import Iterator, List
35
+ import string
35
36
  from io import StringIO
36
37
  import tempfile
37
38
  import csv
@@ -88,6 +89,11 @@ def pyeggp_run(dataset: str, gen: int, nPop: int, maxSize: int, nTournament: int
88
89
  with hs_rts_init():
89
90
  return unsafe_hs_pyeggp_run(dataset, gen, nPop, maxSize, nTournament, pc, pm, nonterminals, loss, optIter, optRepeat, nParams, split, simplify, dumpTo, loadFrom)
90
91
 
92
+ def make_function(expression):
93
+ def func(x, t):
94
+ return eval(expression)
95
+ return func
96
+
91
97
  class PyEGGP(BaseEstimator, RegressorMixin):
92
98
  def __init__(self, gen = 100, nPop = 100, maxSize = 15, nTournament = 3, pc = 0.9, pm = 0.3, nonterminals = "add,sub,mul,div", loss = "MSE", optIter = 50, optRepeat = 2, nParams = -1, split = 1, simplify = False, dumpTo = "", loadFrom = ""):
93
99
  self.gen = gen
@@ -167,6 +173,7 @@ class PyEGGP(BaseEstimator, RegressorMixin):
167
173
  best = self.results[self.results.id==ix].iloc[view]
168
174
  t = np.array(list(map(float, best.theta.split(";"))))
169
175
  return eval(best.Numpy)
176
+
170
177
  def evaluate_model_view(self, x, ix, view):
171
178
  if x.ndim == 1:
172
179
  x = x.reshape(-1,1)
@@ -181,3 +188,19 @@ class PyEGGP(BaseEstimator, RegressorMixin):
181
188
  def score(self, X, y):
182
189
  ypred = self.evaluate_best_model(X)
183
190
  return r2_score(y, ypred)
191
+ def get_model(self, idx):
192
+ alphabet = list(string.ascii_uppercase)
193
+ row = self.results[self.results['id']==idx].iloc[0]
194
+ visual_expression = row['Numpy']
195
+ model = make_function(visual_expression)
196
+ n_params_used = len(row['theta'].split(sep=';'))
197
+
198
+ # Works for solutions with less than 26 parameters
199
+ for i in range(n_params_used):
200
+ visual_expression = visual_expression.replace(f't[{i}]', alphabet[i])
201
+
202
+ # Works for data with less than 50 dimensions
203
+ for i in range(50):
204
+ visual_expression = visual_expression.replace(f'x[:, {i}]', f'X{i}')
205
+
206
+ return model, visual_expression
Binary file
@@ -1,2 +1,2 @@
1
1
  Version: 1.10.0
2
- Arguments: ['C:\\hostedtoolcache\\windows\\Python\\3.12.9\\x64\\Scripts\\delvewheel', 'repair', '-w', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-zhyu2oli\\cp39-win_amd64\\repaired_wheel', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-zhyu2oli\\cp39-win_amd64\\built_wheel\\pyeggp-1.0.1-cp39-cp39-win_amd64.whl', '--add-path', 'C:\\nlopt\\bin']
2
+ Arguments: ['C:\\hostedtoolcache\\windows\\Python\\3.12.9\\x64\\Scripts\\delvewheel', 'repair', '-w', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-qm6p78zx\\cp39-win_amd64\\repaired_wheel', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-qm6p78zx\\cp39-win_amd64\\built_wheel\\pyeggp-1.0.3-cp39-cp39-win_amd64.whl', '--add-path', 'C:\\nlopt\\bin']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyeggp
3
- Version: 1.0.1
3
+ Version: 1.0.3
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
@@ -0,0 +1,19 @@
1
+ pyeggp/binding.i,sha256=UvqL1SWs47LNCpgN3F6l3oufPvwaqUzdHpk0cEZQa5M,1972
2
+ pyeggp/typing.py,sha256=aVUeV85Ig86cccHbyV1KDWjp_ioTl6z3omPA2ZPk0-4,531
3
+ pyeggp/_binding.cp39-win_amd64.pyd,sha256=c5vROjzSQDF5rAnCkW7m6ZvGdvMg2Y7P_xGB61Gi1xo,40249344
4
+ pyeggp/_binding.py,sha256=ICqyFEFXpHDWkon209MQAx5_nMldz1ZzZQh8gBm2lyw,597
5
+ pyeggp/_binding.pyi,sha256=tLpel6vl4zZ_mftC6zVaWVfV2zhVxDLIZpFQ3cisgH4,467
6
+ pyeggp/__init__.py,sha256=aIZwDjMLj57vRt5brF80_uOPBF9RSwGuSvW6J3ejAi4,8314
7
+ pyeggp/__main__.py,sha256=b5xBNv5E7XRE2a2cCHvSYQvDTJ7i6SR2JuAvstvEaFE,166
8
+ pyeggp-1.0.3.dist-info/DELVEWHEEL,sha256=aPhas3MfP1Qq00z3du72rXSS9ld3nFpmOuUOrbActVo,383
9
+ pyeggp-1.0.3.dist-info/entry_points.txt,sha256=NJouaQ2UoCLBu7Toqer0FBvNSDYMawR_Wx9STMdopyY,48
10
+ pyeggp-1.0.3.dist-info/METADATA,sha256=uWz6ft4wZxQewFJiLd012SN4JGlI96Rmz2Cy7u5EAtc,42930
11
+ pyeggp-1.0.3.dist-info/RECORD,,
12
+ pyeggp-1.0.3.dist-info/top_level.txt,sha256=iLrWfWZHh4NruYDgVyn2ntEB-uJ8fIs95nzNVLIhKE4,7
13
+ pyeggp-1.0.3.dist-info/WHEEL,sha256=3JRrBaG_r4GKEsQxd6dVT34joOu5By0wlyszd6u_ofs,99
14
+ pyeggp-1.0.3.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
15
+ pyeggp.libs/.load-order-pyeggp-1.0.3,sha256=KOTskSU5nXQtydlew6agf67kfY8su7f0LBFvrClOy1w,200
16
+ pyeggp.libs/libgcc_s_seh-1-c7e71e753d95ee0b157469f5daa29a03.dll,sha256=OaympRU538qibFmFvn4Gt-RCKJiOQeGMApqEFl7_fKY,101376
17
+ pyeggp.libs/libnlopt-810c2780d280c15810de7e03927423a0.dll,sha256=uCYSNw5_nTmFKD3tWiW1xLIY_BuRaaBNcYBRZIBUYtU,749190
18
+ pyeggp.libs/libstdc++-6-a07611cfa5f65b02dbc1ace58f4dc030.dll,sha256=F4uaDJoJUOIf4DY3GuDR8SWay0W_LEel8SY8zJYod-k,2020352
19
+ pyeggp.libs/libwinpthread-1-2db4a17751d27a5781b70c35799daa95.dll,sha256=4BuOhf1nwrhh9k1MzH32B1m1iapBAACij6K4SiCJF1s,54784
@@ -1,4 +1,4 @@
1
+ libnlopt-810c2780d280c15810de7e03927423a0.dll
1
2
  libgcc_s_seh-1-c7e71e753d95ee0b157469f5daa29a03.dll
2
3
  libwinpthread-1-2db4a17751d27a5781b70c35799daa95.dll
3
- libnlopt-b2a417291a17d7165e68e732209d21b7.dll
4
4
  libstdc++-6-a07611cfa5f65b02dbc1ace58f4dc030.dll
@@ -1,19 +0,0 @@
1
- pyeggp/binding.i,sha256=UvqL1SWs47LNCpgN3F6l3oufPvwaqUzdHpk0cEZQa5M,1972
2
- pyeggp/typing.py,sha256=aVUeV85Ig86cccHbyV1KDWjp_ioTl6z3omPA2ZPk0-4,531
3
- pyeggp/_binding.cp39-win_amd64.pyd,sha256=SHX46wqqY2M2eLehRa3hYouk1du_VShbGQhOvMbyi6s,40247296
4
- pyeggp/_binding.py,sha256=ICqyFEFXpHDWkon209MQAx5_nMldz1ZzZQh8gBm2lyw,597
5
- pyeggp/_binding.pyi,sha256=tLpel6vl4zZ_mftC6zVaWVfV2zhVxDLIZpFQ3cisgH4,467
6
- pyeggp/__init__.py,sha256=nTPXNPqqnofO2DNYIghYOhkZITntjaFNNJr-QuP_EUE,7493
7
- pyeggp/__main__.py,sha256=b5xBNv5E7XRE2a2cCHvSYQvDTJ7i6SR2JuAvstvEaFE,166
8
- pyeggp-1.0.1.dist-info/DELVEWHEEL,sha256=Y0KLiu3D2TXwA83KtpSGbIuxRv84YPQi4NoL-d-H2c8,383
9
- pyeggp-1.0.1.dist-info/entry_points.txt,sha256=NJouaQ2UoCLBu7Toqer0FBvNSDYMawR_Wx9STMdopyY,48
10
- pyeggp-1.0.1.dist-info/METADATA,sha256=wfKNMJ1kKfJART80WinVVLyFK2VbIzruzoFw4mkpDHs,42930
11
- pyeggp-1.0.1.dist-info/RECORD,,
12
- pyeggp-1.0.1.dist-info/top_level.txt,sha256=iLrWfWZHh4NruYDgVyn2ntEB-uJ8fIs95nzNVLIhKE4,7
13
- pyeggp-1.0.1.dist-info/WHEEL,sha256=3JRrBaG_r4GKEsQxd6dVT34joOu5By0wlyszd6u_ofs,99
14
- pyeggp-1.0.1.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
15
- pyeggp.libs/.load-order-pyeggp-1.0.1,sha256=NPfCR-J1Vj8Z40BRBXxgkDrjzP6Z_Vt3mOYyurF5RJA,200
16
- pyeggp.libs/libgcc_s_seh-1-c7e71e753d95ee0b157469f5daa29a03.dll,sha256=OaympRU538qibFmFvn4Gt-RCKJiOQeGMApqEFl7_fKY,101376
17
- pyeggp.libs/libnlopt-b2a417291a17d7165e68e732209d21b7.dll,sha256=QvUMosCR0lNzg2Y5aRnDAI3AzCT4Xw_9tU7swrKkRa8,749190
18
- pyeggp.libs/libstdc++-6-a07611cfa5f65b02dbc1ace58f4dc030.dll,sha256=F4uaDJoJUOIf4DY3GuDR8SWay0W_LEel8SY8zJYod-k,2020352
19
- pyeggp.libs/libwinpthread-1-2db4a17751d27a5781b70c35799daa95.dll,sha256=4BuOhf1nwrhh9k1MzH32B1m1iapBAACij6K4SiCJF1s,54784
File without changes