MilesCranmer commited on
Commit
4ff119b
1 Parent(s): 9e02588

Enable many files to run at once by dump to random filename

Browse files
Files changed (3) hide show
  1. .gitignore +2 -2
  2. eureqa.jl +1 -3
  3. eureqa.py +4 -3
.gitignore CHANGED
@@ -1,3 +1,3 @@
1
- .dataset.jl
2
- .hyperparams.jl
3
  *.csv
 
1
+ .dataset*.jl
2
+ .hyperparams*.jl
3
  *.csv
eureqa.jl CHANGED
@@ -1,5 +1,3 @@
1
- include(".hyperparams.jl")
2
- include(".dataset.jl")
3
  import Optim
4
 
5
  const maxdegree = 2
@@ -325,7 +323,7 @@ end
325
  # Go through one simulated annealing mutation cycle
326
  # exp(-delta/T) defines probability of accepting a change
327
  function iterate(
328
- tree::Node, T::Float32,
329
  annealing::Bool=true
330
  )::Node
331
  prev = tree
 
 
 
1
  import Optim
2
 
3
  const maxdegree = 2
 
323
  # Go through one simulated annealing mutation cycle
324
  # exp(-delta/T) defines probability of accepting a change
325
  function iterate(
326
+ tree::Node, T::Float32;
327
  annealing::Bool=true
328
  )::Node
329
  prev = tree
eureqa.py CHANGED
@@ -72,6 +72,7 @@ def eureqa(X=None, y=None, threads=4, parsimony=1e-3, alpha=10,
72
  Returns:
73
  Pandas dataset listing (complexity, MSE, equation string)
74
  """
 
75
 
76
  if isinstance(binary_operators, str): binary_operators = [binary_operators]
77
  if isinstance(unary_operators, str): unary_operators = [unary_operators]
@@ -133,17 +134,17 @@ def eureqa(X=None, y=None, threads=4, parsimony=1e-3, alpha=10,
133
 
134
  os.system(code_path)
135
 
136
- with open('.hyperparams.jl', 'w') as f:
137
  print(def_hyperparams, file=f)
138
 
139
- with open('.dataset.jl', 'w') as f:
140
  print(def_datasets, file=f)
141
 
142
  command = [
143
  'julia -O3',
144
  f'--threads {threads}',
145
  '-e',
146
- f'\'include("eureqa.jl"); fullRun({niterations:d}, npop={npop:d}, annealing={"true" if annealing else "false"}, ncyclesperiteration={ncyclesperiteration:d}, fractionReplaced={fractionReplaced:f}f0, verbosity=round(Int32, 1e9), topn={topn:d})\'',
147
  ]
148
  cur_cmd = ' '.join(command)
149
  print("Running on", cur_cmd)
 
72
  Returns:
73
  Pandas dataset listing (complexity, MSE, equation string)
74
  """
75
+ rand_string = f'{"".join([str(np.random.rand())[2] for i in range(20)])}'
76
 
77
  if isinstance(binary_operators, str): binary_operators = [binary_operators]
78
  if isinstance(unary_operators, str): unary_operators = [unary_operators]
 
134
 
135
  os.system(code_path)
136
 
137
+ with open(f'.hyperparams_{rand_string}.jl', 'w') as f:
138
  print(def_hyperparams, file=f)
139
 
140
+ with open(f'.dataset_{rand_string}.jl', 'w') as f:
141
  print(def_datasets, file=f)
142
 
143
  command = [
144
  'julia -O3',
145
  f'--threads {threads}',
146
  '-e',
147
+ f'\'include(".hyperparams_{rand_string}.jl"); include(".dataset_{rand_string}.jl"); include("eureqa.jl"); fullRun({niterations:d}, npop={npop:d}, annealing={"true" if annealing else "false"}, ncyclesperiteration={ncyclesperiteration:d}, fractionReplaced={fractionReplaced:f}f0, verbosity=round(Int32, 1e9), topn={topn:d})\'',
148
  ]
149
  cur_cmd = ' '.join(command)
150
  print("Running on", cur_cmd)