Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
a8bf212
1
Parent(s):
4f133b3
Automatically update Julia packages
Browse files- pysr/sr.py +8 -3
- setup.py +1 -1
pysr/sr.py
CHANGED
@@ -102,7 +102,8 @@ def pysr(X=None, y=None, weights=None,
|
|
102 |
delete_tempfiles=True,
|
103 |
julia_optimization=3,
|
104 |
julia_project=None,
|
105 |
-
user_input=True
|
|
|
106 |
):
|
107 |
"""Run symbolic regression to fit f(X[i, :]) ~ y[i] for all i.
|
108 |
Note: most default parameters have been tuned over several example
|
@@ -240,7 +241,7 @@ def pysr(X=None, y=None, weights=None,
|
|
240 |
fractionReplaced=fractionReplaced,
|
241 |
ncyclesperiteration=ncyclesperiteration,
|
242 |
niterations=niterations, npop=npop,
|
243 |
-
topn=topn, verbosity=verbosity,
|
244 |
julia_optimization=julia_optimization, timeout=timeout,
|
245 |
fractionReplacedHof=fractionReplacedHof,
|
246 |
hofMigration=hofMigration, maxdepth=maxdepth,
|
@@ -271,6 +272,7 @@ def pysr(X=None, y=None, weights=None,
|
|
271 |
kwargs['need_install'] = (not user_input) or _yesno("I will install Julia packages using PySR's Project.toml file. OK?")
|
272 |
if kwargs['need_install']:
|
273 |
print("OK. I will install at launch.")
|
|
|
274 |
|
275 |
kwargs['def_hyperparams'] = _create_inline_operators(**kwargs)
|
276 |
|
@@ -328,7 +330,7 @@ def _cmd_runner(command):
|
|
328 |
def _create_julia_files(dataset_filename, def_datasets, hyperparam_filename, def_hyperparams,
|
329 |
fractionReplaced, ncyclesperiteration, niterations, npop,
|
330 |
runfile_filename, topn, verbosity, julia_project, procs, weights,
|
331 |
-
X, variable_names, pkg_directory, need_install, **kwargs):
|
332 |
with open(hyperparam_filename, 'w') as f:
|
333 |
print(def_hyperparams, file=f)
|
334 |
with open(dataset_filename, 'w') as f:
|
@@ -342,7 +344,10 @@ def _create_julia_files(dataset_filename, def_datasets, hyperparam_filename, de
|
|
342 |
print(f'Pkg.activate("{_escape_filename(julia_project)}")', file=f)
|
343 |
if need_install:
|
344 |
print(f'Pkg.instantiate()', file=f)
|
|
|
345 |
print(f'Pkg.precompile()', file=f)
|
|
|
|
|
346 |
print(f'using SymbolicRegression', file=f)
|
347 |
print(f'include("{_escape_filename(hyperparam_filename)}")', file=f)
|
348 |
print(f'include("{_escape_filename(dataset_filename)}")', file=f)
|
|
|
102 |
delete_tempfiles=True,
|
103 |
julia_optimization=3,
|
104 |
julia_project=None,
|
105 |
+
user_input=True,
|
106 |
+
update=True
|
107 |
):
|
108 |
"""Run symbolic regression to fit f(X[i, :]) ~ y[i] for all i.
|
109 |
Note: most default parameters have been tuned over several example
|
|
|
241 |
fractionReplaced=fractionReplaced,
|
242 |
ncyclesperiteration=ncyclesperiteration,
|
243 |
niterations=niterations, npop=npop,
|
244 |
+
topn=topn, verbosity=verbosity, update=update,
|
245 |
julia_optimization=julia_optimization, timeout=timeout,
|
246 |
fractionReplacedHof=fractionReplacedHof,
|
247 |
hofMigration=hofMigration, maxdepth=maxdepth,
|
|
|
272 |
kwargs['need_install'] = (not user_input) or _yesno("I will install Julia packages using PySR's Project.toml file. OK?")
|
273 |
if kwargs['need_install']:
|
274 |
print("OK. I will install at launch.")
|
275 |
+
assert update
|
276 |
|
277 |
kwargs['def_hyperparams'] = _create_inline_operators(**kwargs)
|
278 |
|
|
|
330 |
def _create_julia_files(dataset_filename, def_datasets, hyperparam_filename, def_hyperparams,
|
331 |
fractionReplaced, ncyclesperiteration, niterations, npop,
|
332 |
runfile_filename, topn, verbosity, julia_project, procs, weights,
|
333 |
+
X, variable_names, pkg_directory, need_install, update, **kwargs):
|
334 |
with open(hyperparam_filename, 'w') as f:
|
335 |
print(def_hyperparams, file=f)
|
336 |
with open(dataset_filename, 'w') as f:
|
|
|
344 |
print(f'Pkg.activate("{_escape_filename(julia_project)}")', file=f)
|
345 |
if need_install:
|
346 |
print(f'Pkg.instantiate()', file=f)
|
347 |
+
print(f'Pkg.update()', file=f)
|
348 |
print(f'Pkg.precompile()', file=f)
|
349 |
+
elif update:
|
350 |
+
print(f'Pkg.update()', file=f)
|
351 |
print(f'using SymbolicRegression', file=f)
|
352 |
print(f'include("{_escape_filename(hyperparam_filename)}")', file=f)
|
353 |
print(f'include("{_escape_filename(dataset_filename)}")', file=f)
|
setup.py
CHANGED
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
5 |
|
6 |
setuptools.setup(
|
7 |
name="pysr", # Replace with your own username
|
8 |
-
version="0.4.
|
9 |
author="Miles Cranmer",
|
10 |
author_email="[email protected]",
|
11 |
description="Simple and efficient symbolic regression",
|
|
|
5 |
|
6 |
setuptools.setup(
|
7 |
name="pysr", # Replace with your own username
|
8 |
+
version="0.4.4",
|
9 |
author="Miles Cranmer",
|
10 |
author_email="[email protected]",
|
11 |
description="Simple and efficient symbolic regression",
|