MilesCranmer commited on
Commit
03e8b8d
1 Parent(s): 6083305

Add datetime to default equation file

Browse files
Files changed (2) hide show
  1. docs/options.md +1 -1
  2. pysr/sr.py +5 -1
docs/options.md CHANGED
@@ -22,7 +22,7 @@ These are described below
22
  The program will output a pandas DataFrame containing the equations,
23
  mean square error, and complexity. It will also dump to a csv
24
  at the end of every iteration,
25
- which is `hall_of_fame.csv` by default. It also prints the
26
  equations to stdout.
27
 
28
  ## Operators
 
22
  The program will output a pandas DataFrame containing the equations,
23
  mean square error, and complexity. It will also dump to a csv
24
  at the end of every iteration,
25
+ which is `hall_of_fame_{date_time}.csv` by default. It also prints the
26
  equations to stdout.
27
 
28
  ## Operators
pysr/sr.py CHANGED
@@ -10,6 +10,7 @@ import subprocess
10
  import tempfile
11
  import shutil
12
  from pathlib import Path
 
13
 
14
 
15
  global_equation_file = 'hall_of_fame.csv'
@@ -83,7 +84,7 @@ def pysr(X=None, y=None, weights=None,
83
  nrestarts=3,
84
  timeout=None,
85
  extra_sympy_mappings={},
86
- equation_file='hall_of_fame.csv',
87
  test='simple1',
88
  verbosity=1e9,
89
  maxsize=20,
@@ -196,6 +197,9 @@ def pysr(X=None, y=None, weights=None,
196
  raise ValueError("The limitPowComplexity kwarg is deprecated. Use constraints.")
197
  if maxdepth is None:
198
  maxdepth = maxsize
 
 
 
199
 
200
  if isinstance(X, pd.DataFrame):
201
  variable_names = list(X.columns)
 
10
  import tempfile
11
  import shutil
12
  from pathlib import Path
13
+ from datetime import datetime
14
 
15
 
16
  global_equation_file = 'hall_of_fame.csv'
 
84
  nrestarts=3,
85
  timeout=None,
86
  extra_sympy_mappings={},
87
+ equation_file=None,
88
  test='simple1',
89
  verbosity=1e9,
90
  maxsize=20,
 
197
  raise ValueError("The limitPowComplexity kwarg is deprecated. Use constraints.")
198
  if maxdepth is None:
199
  maxdepth = maxsize
200
+ if equation_file is None:
201
+ date_time = datetime.now().strftime("%m_%d_%Y_%H:%M:%S")
202
+ equation_file = 'hall_of_fame_' + date_time + '.csv'
203
 
204
  if isinstance(X, pd.DataFrame):
205
  variable_names = list(X.columns)