Spaces:
Running
Running
Commit
·
e9073ea
1
Parent(s):
35a3c2d
Update docs
Browse files- docs/start.md +10 -8
- example.py +3 -0
docs/start.md
CHANGED
|
@@ -44,8 +44,10 @@ model = PySRRegressor(
|
|
| 44 |
"cos",
|
| 45 |
"exp",
|
| 46 |
"sin",
|
|
|
|
| 47 |
],
|
| 48 |
model_selection="best",
|
|
|
|
| 49 |
)
|
| 50 |
```
|
| 51 |
This will set up the model for 5 iterations of the search code, which contains hundreds of thousands of mutations and equation evaluations.
|
|
@@ -69,13 +71,13 @@ print(model)
|
|
| 69 |
to print the learned equations:
|
| 70 |
```python
|
| 71 |
PySRRegressor.equations = [
|
| 72 |
-
|
| 73 |
-
0 0.000000 3.
|
| 74 |
-
1
|
| 75 |
-
2 0.
|
| 76 |
-
3 0.
|
| 77 |
-
4 0.
|
| 78 |
-
5 >>>>
|
| 79 |
]
|
| 80 |
```
|
| 81 |
This arrow in the `pick` column indicates which equation is currently selected by your
|
|
@@ -88,7 +90,7 @@ SymPy format (`sympy_format`), and even JAX and PyTorch format
|
|
| 88 |
(both of which are differentiable).
|
| 89 |
|
| 90 |
There are several other useful features such as denoising (e.g., `denoising=True`),
|
| 91 |
-
feature selection (e.g., `select_k_features=3`).
|
| 92 |
For a summary of features and options, see [this docs page](https://pysr.readthedocs.io/en/latest/docs/options/).
|
| 93 |
You can see the full API at [this page](https://pysr.readthedocs.io/en/latest/docs/api-documentation/).
|
| 94 |
|
|
|
|
| 44 |
"cos",
|
| 45 |
"exp",
|
| 46 |
"sin",
|
| 47 |
+
"inv(x)=1/x", # Custom operator (julia syntax)
|
| 48 |
],
|
| 49 |
model_selection="best",
|
| 50 |
+
loss="loss(x, y) = (x - y)^2", # Custom loss function (julia syntax)
|
| 51 |
)
|
| 52 |
```
|
| 53 |
This will set up the model for 5 iterations of the search code, which contains hundreds of thousands of mutations and equation evaluations.
|
|
|
|
| 71 |
to print the learned equations:
|
| 72 |
```python
|
| 73 |
PySRRegressor.equations = [
|
| 74 |
+
pick score equation loss complexity
|
| 75 |
+
0 0.000000 3.0282464 2.816982e+01 1
|
| 76 |
+
1 1.008026 (x0 * x0) 3.751666e+00 3
|
| 77 |
+
2 0.015337 (-0.33649465 + (x0 * x0)) 3.638336e+00 5
|
| 78 |
+
3 0.888050 ((x0 * x0) + cos(x3)) 1.497019e+00 6
|
| 79 |
+
4 0.898539 ((x0 * x0) + (2.4816332 * cos(x3))) 2.481797e-01 8
|
| 80 |
+
5 >>>> 10.604434 ((-0.49998775 + (x0 * x0)) + (2.5382009 * cos(... 1.527115e-10 10
|
| 81 |
]
|
| 82 |
```
|
| 83 |
This arrow in the `pick` column indicates which equation is currently selected by your
|
|
|
|
| 90 |
(both of which are differentiable).
|
| 91 |
|
| 92 |
There are several other useful features such as denoising (e.g., `denoising=True`),
|
| 93 |
+
feature selection (e.g., `select_k_features=3`), and many others.
|
| 94 |
For a summary of features and options, see [this docs page](https://pysr.readthedocs.io/en/latest/docs/options/).
|
| 95 |
You can see the full API at [this page](https://pysr.readthedocs.io/en/latest/docs/api-documentation/).
|
| 96 |
|
example.py
CHANGED
|
@@ -13,8 +13,11 @@ model = PySRRegressor(
|
|
| 13 |
"cos",
|
| 14 |
"exp",
|
| 15 |
"sin",
|
|
|
|
| 16 |
],
|
| 17 |
model_selection="best",
|
|
|
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
model.fit(X, y)
|
|
|
|
| 13 |
"cos",
|
| 14 |
"exp",
|
| 15 |
"sin",
|
| 16 |
+
"inv(x)=1/x", # Custom operator (julia syntax)
|
| 17 |
],
|
| 18 |
model_selection="best",
|
| 19 |
+
loss="loss(x, y) = (x - y)^2", # Custom loss function (julia syntax)
|
| 20 |
+
multithreading=False,
|
| 21 |
)
|
| 22 |
|
| 23 |
model.fit(X, y)
|