MilesCranmer commited on
Commit
b8953fa
1 Parent(s): f456047

Update PySR default settings as in https://github.com/MilesCranmer/PySR/discussions/115\#discussioncomment-2273348

Browse files
Files changed (2) hide show
  1. pysr/sr.py +29 -22
  2. pysr/version.py +2 -2
pysr/sr.py CHANGED
@@ -350,30 +350,30 @@ class PySRRegressor(BaseEstimator, RegressorMixin):
350
  unary_operators=None,
351
  procs=cpu_count(),
352
  loss="L2DistLoss()",
353
- populations=100,
354
  niterations=4,
355
- ncyclesperiteration=100,
356
  timeout_in_seconds=None,
357
  alpha=0.1,
358
  annealing=False,
359
- fractionReplaced=0.01,
360
- fractionReplacedHof=0.005,
361
- npop=100,
362
- parsimony=1e-4,
363
  migration=True,
364
  hofMigration=True,
365
  shouldOptimizeConstants=True,
366
- topn=10,
367
- weightAddNode=1,
368
- weightInsertNode=3,
369
- weightDeleteNode=3,
370
- weightDoNothing=1,
371
- weightMutateConstant=10,
372
- weightMutateOperator=1,
373
- weightRandomize=1,
374
- weightSimplify=0.002,
375
- crossoverProbability=0.01,
376
- perturbationFactor=1.0,
377
  extra_sympy_mappings=None,
378
  extra_torch_mappings=None,
379
  extra_jax_mappings=None,
@@ -391,6 +391,7 @@ class PySRRegressor(BaseEstimator, RegressorMixin):
391
  warmupMaxsizeBy=0.0,
392
  constraints=None,
393
  useFrequency=True,
 
394
  tempdir=None,
395
  delete_tempfiles=True,
396
  julia_project=None,
@@ -399,11 +400,11 @@ class PySRRegressor(BaseEstimator, RegressorMixin):
399
  output_jax_format=False,
400
  output_torch_format=False,
401
  optimizer_algorithm="BFGS",
402
- optimizer_nrestarts=3,
403
- optimize_probability=1.0,
404
- optimizer_iterations=10,
405
  tournament_selection_n=10,
406
- tournament_selection_p=1.0,
407
  denoise=False,
408
  Xresampled=None,
409
  precision=32,
@@ -509,6 +510,8 @@ class PySRRegressor(BaseEstimator, RegressorMixin):
509
  :type constraints: dict
510
  :param useFrequency: whether to measure the frequency of complexities, and use that instead of parsimony to explore equation space. Will naturally find equations of all complexities.
511
  :type useFrequency: bool
 
 
512
  :param tempdir: directory for the temporary files
513
  :type tempdir: str/None
514
  :param delete_tempfiles: whether to delete the temporary files after finishing
@@ -647,6 +650,7 @@ class PySRRegressor(BaseEstimator, RegressorMixin):
647
  warmupMaxsizeBy=warmupMaxsizeBy,
648
  constraints=constraints,
649
  useFrequency=useFrequency,
 
650
  tempdir=tempdir,
651
  delete_tempfiles=delete_tempfiles,
652
  update=update,
@@ -756,8 +760,10 @@ class PySRRegressor(BaseEstimator, RegressorMixin):
756
  for key, value in params.items():
757
  if key in self.surface_parameters:
758
  self.__setattr__(key, value)
759
- else:
760
  self.params[key] = value
 
 
761
 
762
  return self
763
 
@@ -1192,6 +1198,7 @@ class PySRRegressor(BaseEstimator, RegressorMixin):
1192
  shouldOptimizeConstants=self.params["shouldOptimizeConstants"],
1193
  warmupMaxsizeBy=self.params["warmupMaxsizeBy"],
1194
  useFrequency=self.params["useFrequency"],
 
1195
  npop=self.params["npop"],
1196
  ncyclesperiteration=self.params["ncyclesperiteration"],
1197
  fractionReplaced=self.params["fractionReplaced"],
 
350
  unary_operators=None,
351
  procs=cpu_count(),
352
  loss="L2DistLoss()",
353
+ populations=15,
354
  niterations=4,
355
+ ncyclesperiteration=550,
356
  timeout_in_seconds=None,
357
  alpha=0.1,
358
  annealing=False,
359
+ fractionReplaced=0.000364,
360
+ fractionReplacedHof=0.035,
361
+ npop=33,
362
+ parsimony=0.0032,
363
  migration=True,
364
  hofMigration=True,
365
  shouldOptimizeConstants=True,
366
+ topn=12,
367
+ weightAddNode=0.79,
368
+ weightDeleteNode=1.7,
369
+ weightDoNothing=0.21,
370
+ weightInsertNode=5.1,
371
+ weightMutateConstant=0.048,
372
+ weightMutateOperator=0.47,
373
+ weightRandomize=0.00023,
374
+ weightSimplify=0.0020,
375
+ crossoverProbability=0.066,
376
+ perturbationFactor=0.076,
377
  extra_sympy_mappings=None,
378
  extra_torch_mappings=None,
379
  extra_jax_mappings=None,
 
391
  warmupMaxsizeBy=0.0,
392
  constraints=None,
393
  useFrequency=True,
394
+ useFrequencyInTournament=True,
395
  tempdir=None,
396
  delete_tempfiles=True,
397
  julia_project=None,
 
400
  output_jax_format=False,
401
  output_torch_format=False,
402
  optimizer_algorithm="BFGS",
403
+ optimizer_nrestarts=2,
404
+ optimize_probability=0.14,
405
+ optimizer_iterations=8,
406
  tournament_selection_n=10,
407
+ tournament_selection_p=0.86,
408
  denoise=False,
409
  Xresampled=None,
410
  precision=32,
 
510
  :type constraints: dict
511
  :param useFrequency: whether to measure the frequency of complexities, and use that instead of parsimony to explore equation space. Will naturally find equations of all complexities.
512
  :type useFrequency: bool
513
+ :param useFrequencyInTournament: whether to use the frequency mentioned above in the tournament, rather than just the simulated annealing.
514
+ :type useFrequencyInTournament: bool
515
  :param tempdir: directory for the temporary files
516
  :type tempdir: str/None
517
  :param delete_tempfiles: whether to delete the temporary files after finishing
 
650
  warmupMaxsizeBy=warmupMaxsizeBy,
651
  constraints=constraints,
652
  useFrequency=useFrequency,
653
+ useFrequencyInTournament=useFrequencyInTournament,
654
  tempdir=tempdir,
655
  delete_tempfiles=delete_tempfiles,
656
  update=update,
 
760
  for key, value in params.items():
761
  if key in self.surface_parameters:
762
  self.__setattr__(key, value)
763
+ elif key in self.params:
764
  self.params[key] = value
765
+ else:
766
+ raise ValueError(f"Parameter {key} is not in the list of parameters.")
767
 
768
  return self
769
 
 
1198
  shouldOptimizeConstants=self.params["shouldOptimizeConstants"],
1199
  warmupMaxsizeBy=self.params["warmupMaxsizeBy"],
1200
  useFrequency=self.params["useFrequency"],
1201
+ useFrequencyInTournament=self.params["useFrequencyInTournament"],
1202
  npop=self.params["npop"],
1203
  ncyclesperiteration=self.params["ncyclesperiteration"],
1204
  fractionReplaced=self.params["fractionReplaced"],
pysr/version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.7.13"
2
- __symbolic_regression_jl_version__ = "0.7.14"
 
1
+ __version__ = "0.8.0"
2
+ __symbolic_regression_jl_version__ = "0.8.0"