MilesCranmer commited on
Commit
81d46f1
1 Parent(s): a9577d1

Enable option for tqdm-like progress bar

Browse files
Files changed (3) hide show
  1. Project.toml +1 -1
  2. pysr/sr.py +8 -4
  3. setup.py +1 -1
Project.toml CHANGED
@@ -2,5 +2,5 @@
2
  SymbolicRegression = "8254be44-1295-4e6a-a16d-46603ac705cb"
3
 
4
  [compat]
5
- SymbolicRegression = "0.5.0"
6
  julia = "1.5"
 
2
  SymbolicRegression = "8254be44-1295-4e6a-a16d-46603ac705cb"
3
 
4
  [compat]
5
+ SymbolicRegression = "0.5.1"
6
  julia = "1.5"
pysr/sr.py CHANGED
@@ -89,6 +89,7 @@ def pysr(X=None, y=None, weights=None,
89
  equation_file=None,
90
  test='simple1',
91
  verbosity=1e9,
 
92
  maxsize=20,
93
  fast_cycle=False,
94
  maxdepth=None,
@@ -172,6 +173,8 @@ def pysr(X=None, y=None, weights=None,
172
  :param timeout: float, Time in seconds to timeout search
173
  :param equation_file: str, Where to save the files (.csv separated by |)
174
  :param test: str, What test to run, if X,y not passed.
 
 
175
  :param maxsize: int, Max size of an equation.
176
  :param maxdepth: int, Max depth of an equation. You can use both maxsize and maxdepth.
177
  maxdepth is by default set to = maxsize, which means that it is redundant.
@@ -255,8 +258,8 @@ def pysr(X=None, y=None, weights=None,
255
  fast_cycle=fast_cycle,
256
  fractionReplaced=fractionReplaced,
257
  ncyclesperiteration=ncyclesperiteration,
258
- niterations=niterations, npop=npop,
259
- topn=topn, verbosity=verbosity, update=update,
260
  julia_optimization=julia_optimization, timeout=timeout,
261
  fractionReplacedHof=fractionReplacedHof,
262
  hofMigration=hofMigration, maxdepth=maxdepth,
@@ -407,7 +410,7 @@ def _make_hyperparams_julia_str(X, alpha, annealing, batchSize, batching, binary
407
  parsimony, perturbationFactor, populations, procs, shouldOptimizeConstants,
408
  unary_operators, useFrequency, use_custom_variable_names,
409
  variable_names, warmupMaxsize, weightAddNode,
410
- ncyclesperiteration, fractionReplaced, topn, verbosity, loss,
411
  weightDeleteNode, weightDoNothing, weightInsertNode, weightMutateConstant,
412
  weightMutateOperator, weightRandomize, weightSimplify, weights, **kwargs):
413
  def tuple_fix(ops):
@@ -473,7 +476,8 @@ npop={npop:d},
473
  ncyclesperiteration={ncyclesperiteration:d},
474
  fractionReplaced={fractionReplaced:f}f0,
475
  topn={topn:d},
476
- verbosity=round(Int32, {verbosity:f})
 
477
  """
478
 
479
  def_hyperparams += '\n)'
 
89
  equation_file=None,
90
  test='simple1',
91
  verbosity=1e9,
92
+ progress=False,
93
  maxsize=20,
94
  fast_cycle=False,
95
  maxdepth=None,
 
173
  :param timeout: float, Time in seconds to timeout search
174
  :param equation_file: str, Where to save the files (.csv separated by |)
175
  :param test: str, What test to run, if X,y not passed.
176
+ :param verbosity: int, What verbosity level to use. 0 means minimal print statements.
177
+ :param progress: bool, Whether to use a progress bar instead of printing to stdout.
178
  :param maxsize: int, Max size of an equation.
179
  :param maxdepth: int, Max depth of an equation. You can use both maxsize and maxdepth.
180
  maxdepth is by default set to = maxsize, which means that it is redundant.
 
258
  fast_cycle=fast_cycle,
259
  fractionReplaced=fractionReplaced,
260
  ncyclesperiteration=ncyclesperiteration,
261
+ niterations=niterations, npop=npop, topn=topn,
262
+ verbosity=verbosity, progress=progress, update=update,
263
  julia_optimization=julia_optimization, timeout=timeout,
264
  fractionReplacedHof=fractionReplacedHof,
265
  hofMigration=hofMigration, maxdepth=maxdepth,
 
410
  parsimony, perturbationFactor, populations, procs, shouldOptimizeConstants,
411
  unary_operators, useFrequency, use_custom_variable_names,
412
  variable_names, warmupMaxsize, weightAddNode,
413
+ ncyclesperiteration, fractionReplaced, topn, verbosity, progress, loss,
414
  weightDeleteNode, weightDoNothing, weightInsertNode, weightMutateConstant,
415
  weightMutateOperator, weightRandomize, weightSimplify, weights, **kwargs):
416
  def tuple_fix(ops):
 
476
  ncyclesperiteration={ncyclesperiteration:d},
477
  fractionReplaced={fractionReplaced:f}f0,
478
  topn={topn:d},
479
+ verbosity=round(Int32, {verbosity:f}),
480
+ progress={'true' if progress else 'false'}
481
  """
482
 
483
  def_hyperparams += '\n)'
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.5.0-1",
9
  author="Miles Cranmer",
10
  author_email="miles.cranmer@gmail.com",
11
  description="Simple and efficient symbolic regression",
 
5
 
6
  setuptools.setup(
7
  name="pysr", # Replace with your own username
8
+ version="0.5.1",
9
  author="Miles Cranmer",
10
  author_email="miles.cranmer@gmail.com",
11
  description="Simple and efficient symbolic regression",