File size: 451 Bytes
bed9614
 
 
 
 
ddb4d52
 
bed9614
ddb4d52
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import numpy as np
from pysr import pysr
X = np.random.randn(100, 5)
y = X[:, 0]

equations = pysr(X, y,
                 niterations=100)
print(equations)
# Accuracy assertion
assert equations.iloc[-1]['MSE'] < 1e-10

y = X[:, 0]**2
equations = pysr(X, y,
                 unary_operators=["square(x) = x^2"], binary_operators=["plus"],
                 niterations=100)
print(equations)
# Accuracy assertion
assert equations.iloc[-1]['MSE'] < 1e-10