Spaces:
Sleeping
Sleeping
AutonLabTruth
commited on
Commit
•
c88fbe0
1
Parent(s):
7e72d81
Renamed Variable Names and Fixed Y to y
Browse files- pysr/Problems.py +5 -4
pysr/Problems.py
CHANGED
@@ -8,10 +8,10 @@ class Problem:
|
|
8 |
|
9 |
Should be able to call pysr(problem.X, problem.y, var_names=problem.var_names) and have it work
|
10 |
"""
|
11 |
-
def __init__(self, X, y,
|
12 |
self.X = X
|
13 |
self.y = y
|
14 |
-
self.
|
15 |
|
16 |
|
17 |
class FeynmanProblem(Problem):
|
@@ -27,7 +27,8 @@ class FeynmanProblem(Problem):
|
|
27 |
self.eq_id = row['Filename']
|
28 |
self.form = row['Formula']
|
29 |
self.n_vars = int(row['# variables'])
|
30 |
-
super(FeynmanProblem, self).__init__(None, None,
|
|
|
31 |
#self.var_names = [row[f'v{i+1}_name'] for i in range(self.n_vars)]
|
32 |
self.low = [float(row[f'v{i+1}_low']) for i in range(self.n_vars)]
|
33 |
self.high = [float(row[f'v{i+1}_high']) for i in range(self.n_vars)]
|
@@ -49,7 +50,7 @@ class FeynmanProblem(Problem):
|
|
49 |
d['ln'] = np.log
|
50 |
d['log'] = np.log # Quite sure the Feynman dataset has no base 10 logs
|
51 |
d['arcsin'] = np.arcsin
|
52 |
-
self.
|
53 |
return
|
54 |
|
55 |
def __str__(self):
|
|
|
8 |
|
9 |
Should be able to call pysr(problem.X, problem.y, var_names=problem.var_names) and have it work
|
10 |
"""
|
11 |
+
def __init__(self, X, y, variable_names=None):
|
12 |
self.X = X
|
13 |
self.y = y
|
14 |
+
self.variable_names = variable_names
|
15 |
|
16 |
|
17 |
class FeynmanProblem(Problem):
|
|
|
27 |
self.eq_id = row['Filename']
|
28 |
self.form = row['Formula']
|
29 |
self.n_vars = int(row['# variables'])
|
30 |
+
super(FeynmanProblem, self).__init__(None, None,
|
31 |
+
variable_names=[row[f'v{i + 1}_name'] for i in range(self.n_vars)])
|
32 |
#self.var_names = [row[f'v{i+1}_name'] for i in range(self.n_vars)]
|
33 |
self.low = [float(row[f'v{i+1}_low']) for i in range(self.n_vars)]
|
34 |
self.high = [float(row[f'v{i+1}_high']) for i in range(self.n_vars)]
|
|
|
50 |
d['ln'] = np.log
|
51 |
d['log'] = np.log # Quite sure the Feynman dataset has no base 10 logs
|
52 |
d['arcsin'] = np.arcsin
|
53 |
+
self.y = eval(self.form,d)
|
54 |
return
|
55 |
|
56 |
def __str__(self):
|