Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
c27a9c8
1
Parent(s):
a86f107
Print with zero-index format
Browse files
eureqa.jl
CHANGED
@@ -73,7 +73,7 @@ function stringTree(tree::Node)::String
|
|
73 |
if tree.constant
|
74 |
return string(tree.val)
|
75 |
else
|
76 |
-
return "x$(tree.val)"
|
77 |
end
|
78 |
elseif tree.degree == 1
|
79 |
return "$(tree.op)($(stringTree(tree.l)))"
|
|
|
73 |
if tree.constant
|
74 |
return string(tree.val)
|
75 |
else
|
76 |
+
return "x$(tree.val - 1)"
|
77 |
end
|
78 |
elseif tree.degree == 1
|
79 |
return "$(tree.op)($(stringTree(tree.l)))"
|
eureqa.py
CHANGED
@@ -17,8 +17,11 @@ def eureqa(X=None, y=None, threads=4, parsimony=1e-3, alpha=10,
|
|
17 |
topn=10, equation_file='hall_of_fame.csv',
|
18 |
test='simple1'
|
19 |
):
|
20 |
-
"""
|
|
|
21 |
|
|
|
|
|
22 |
--threads THREADS Number of threads (default: 4)
|
23 |
--parsimony PARSIMONY
|
24 |
How much to punish complexity (default: 0.001)
|
@@ -58,6 +61,9 @@ def eureqa(X=None, y=None, threads=4, parsimony=1e-3, alpha=10,
|
|
58 |
--unary-operators UNARY_OPERATORS
|
59 |
Unary operators. Make sure they are defined in
|
60 |
operators.jl (default: ['exp', 'sin', 'cos'])
|
|
|
|
|
|
|
61 |
"""
|
62 |
|
63 |
if isinstance(binary_operators, str): binary_operators = [binary_operators]
|
|
|
17 |
topn=10, equation_file='hall_of_fame.csv',
|
18 |
test='simple1'
|
19 |
):
|
20 |
+
""" Runs symbolic regression in Julia, to fit y given X.
|
21 |
+
Either provide a 2D numpy array for X, 1D array for y, or declare a test to run.
|
22 |
|
23 |
+
Arguments:
|
24 |
+
|
25 |
--threads THREADS Number of threads (default: 4)
|
26 |
--parsimony PARSIMONY
|
27 |
How much to punish complexity (default: 0.001)
|
|
|
61 |
--unary-operators UNARY_OPERATORS
|
62 |
Unary operators. Make sure they are defined in
|
63 |
operators.jl (default: ['exp', 'sin', 'cos'])
|
64 |
+
|
65 |
+
Returns:
|
66 |
+
Pandas dataset listing (complexity, MSE, equation string)
|
67 |
"""
|
68 |
|
69 |
if isinstance(binary_operators, str): binary_operators = [binary_operators]
|