Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
226786e
1
Parent(s):
4854265
Remove tab on generated files
Browse files
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 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
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 |
-
|
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()}'
|