MilesCranmer commited on
Commit
226786e
1 Parent(s): 4854265

Remove tab on generated files

Browse files
Files changed (1) hide show
  1. eureqa.py +24 -26
eureqa.py CHANGED
@@ -94,29 +94,28 @@ def eureqa(X=None, y=None, threads=4, parsimony=1e-3, alpha=10,
94
  y = eval(eval_str)
95
  print("Running on", eval_str)
96
 
97
- def_hyperparams = f"""
98
- include("operators.jl")
99
- const binops = {'[' + ', '.join(binary_operators) + ']'}
100
- const unaops = {'[' + ', '.join(unary_operators) + ']'}
101
- const ns=10;
102
- const parsimony = {parsimony:f}f0
103
- const alpha = {alpha:f}f0
104
- const maxsize = {maxsize:d}
105
- const migration = {'true' if migration else 'false'}
106
- const hofMigration = {'true' if hofMigration else 'false'}
107
- const fractionReplacedHof = {fractionReplacedHof}f0
108
- const shouldOptimizeConstants = {'true' if shouldOptimizeConstants else 'false'}
109
- const hofFile = "{equation_file}"
110
- const nthreads = {threads:d}
111
- const mutationWeights = [
112
- {weightMutateConstant:f},
113
- {weightMutateOperator:f},
114
- {weightAddNode:f},
115
- {weightDeleteNode:f},
116
- {weightSimplify:f},
117
- {weightRandomize:f},
118
- {weightDoNothing:f}
119
- ]
120
  """
121
 
122
  assert len(X.shape) == 2
@@ -125,9 +124,8 @@ def eureqa(X=None, y=None, threads=4, parsimony=1e-3, alpha=10,
125
  X_str = str(X.tolist()).replace('],', '];').replace(',', '')
126
  y_str = str(y.tolist())
127
 
128
- def_datasets = """
129
- const X = convert(Array{Float32, 2}, """f"{X_str})""""
130
- const y = convert(Array{Float32, 1}, """f"{y_str})""""
131
  """
132
 
133
  starting_path = f'cd {pathlib.Path().absolute()}'
 
94
  y = eval(eval_str)
95
  print("Running on", eval_str)
96
 
97
+ def_hyperparams = f"""include("operators.jl")
98
+ const binops = {'[' + ', '.join(binary_operators) + ']'}
99
+ const unaops = {'[' + ', '.join(unary_operators) + ']'}
100
+ const ns=10;
101
+ const parsimony = {parsimony:f}f0
102
+ const alpha = {alpha:f}f0
103
+ const maxsize = {maxsize:d}
104
+ const migration = {'true' if migration else 'false'}
105
+ const hofMigration = {'true' if hofMigration else 'false'}
106
+ const fractionReplacedHof = {fractionReplacedHof}f0
107
+ const shouldOptimizeConstants = {'true' if shouldOptimizeConstants else 'false'}
108
+ const hofFile = "{equation_file}"
109
+ const nthreads = {threads:d}
110
+ const mutationWeights = [
111
+ {weightMutateConstant:f},
112
+ {weightMutateOperator:f},
113
+ {weightAddNode:f},
114
+ {weightDeleteNode:f},
115
+ {weightSimplify:f},
116
+ {weightRandomize:f},
117
+ {weightDoNothing:f}
118
+ ]
 
119
  """
120
 
121
  assert len(X.shape) == 2
 
124
  X_str = str(X.tolist()).replace('],', '];').replace(',', '')
125
  y_str = str(y.tolist())
126
 
127
+ def_datasets = """const X = convert(Array{Float32, 2}, """f"{X_str})""""
128
+ const y = convert(Array{Float32, 1}, """f"{y_str})""""
 
129
  """
130
 
131
  starting_path = f'cd {pathlib.Path().absolute()}'