MilesCranmer commited on
Commit
ddb4d52
1 Parent(s): 3629549

Add test for custom operator

Browse files
Files changed (1) hide show
  1. test/test.py +12 -1
test/test.py CHANGED
@@ -3,5 +3,16 @@ from pysr import pysr
3
  X = np.random.randn(100, 5)
4
  y = X[:, 0]
5
 
6
- equations = pysr(X, y, niterations=2)
 
7
  print(equations)
 
 
 
 
 
 
 
 
 
 
 
3
  X = np.random.randn(100, 5)
4
  y = X[:, 0]
5
 
6
+ equations = pysr(X, y,
7
+ niterations=100)
8
  print(equations)
9
+ # Accuracy assertion
10
+ assert equations.iloc[-1]['MSE'] < 1e-10
11
+
12
+ y = X[:, 0]**2
13
+ equations = pysr(X, y,
14
+ unary_operators=["square(x) = x^2"], binary_operators=["plus"],
15
+ niterations=100)
16
+ print(equations)
17
+ # Accuracy assertion
18
+ assert equations.iloc[-1]['MSE'] < 1e-10