Spaces:
Running
Running
Commit
·
35b3043
1
Parent(s):
9e11722
Created a main.py file to run
Browse files
main.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
from pysr import pysr, best, get_hof
|
| 3 |
+
|
| 4 |
+
# Dataset
|
| 5 |
+
X = 2*np.random.randn(100, 5)
|
| 6 |
+
y = 2*np.cos(X[:, 3]) + X[:, 0]**2 - 2
|
| 7 |
+
|
| 8 |
+
# Learn equations
|
| 9 |
+
equations = pysr(X, y, niterations=5,
|
| 10 |
+
binary_operators=["plus", "mult"],
|
| 11 |
+
unary_operators=["cos", "exp", "sin"])
|
| 12 |
+
|
| 13 |
+
... # (you can use ctl-c to exit early)
|
| 14 |
+
|
| 15 |
+
print(best(equations))
|