Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
e881315
1
Parent(s):
546ea43
Clean up README
Browse files
README.md
CHANGED
@@ -8,7 +8,6 @@ https://user-images.githubusercontent.com/7593028/188328887-1b6cda72-2f41-439e-a
|
|
8 |
|
9 |
</div>
|
10 |
|
11 |
-
|
12 |
PySR uses evolutionary algorithms to search for symbolic expressions which optimize a particular objective.
|
13 |
|
14 |
<div align="center">
|
@@ -19,13 +18,11 @@ PySR uses evolutionary algorithms to search for symbolic expressions which optim
|
|
19 |
|
20 |
</div>
|
21 |
|
22 |
-
|
23 |
(pronounced like *py* as in python, and then *sur* as in surface)
|
24 |
|
25 |
If you find PySR useful, please cite it using the citation information given in [CITATION.md](https://github.com/MilesCranmer/PySR/blob/master/CITATION.md).
|
26 |
If you've finished a project with PySR, please submit a PR to showcase your work on the [Research Showcase page](https://astroautomata.com/PySR/papers)!
|
27 |
|
28 |
-
|
29 |
<div align="center">
|
30 |
|
31 |
### Test status
|
@@ -33,10 +30,9 @@ If you've finished a project with PySR, please submit a PR to showcase your work
|
|
33 |
| **Linux** | **Windows** | **macOS (intel)** |
|
34 |
|---|---|---|
|
35 |
|[![Linux](https://github.com/MilesCranmer/PySR/actions/workflows/CI.yml/badge.svg)](https://github.com/MilesCranmer/PySR/actions/workflows/CI.yml)|[![Windows](https://github.com/MilesCranmer/PySR/actions/workflows/CI_Windows.yml/badge.svg)](https://github.com/MilesCranmer/PySR/actions/workflows/CI_Windows.yml)|[![macOS](https://github.com/MilesCranmer/PySR/actions/workflows/CI_mac.yml/badge.svg)](https://github.com/MilesCranmer/PySR/actions/workflows/CI_mac.yml)|
|
36 |
-
| **Docker** | **Conda** | **Coverage** |
|
37 |
|[![Docker](https://github.com/MilesCranmer/PySR/actions/workflows/CI_docker.yml/badge.svg)](https://github.com/MilesCranmer/PySR/actions/workflows/CI_docker.yml)|[![conda-forge](https://github.com/MilesCranmer/PySR/actions/workflows/CI_conda_forge.yml/badge.svg)](https://github.com/MilesCranmer/PySR/actions/workflows/CI_conda_forge.yml)|[![Coverage Status](https://coveralls.io/repos/github/MilesCranmer/PySR/badge.svg?branch=master&service=github)](https://coveralls.io/github/MilesCranmer/PySR)|
|
38 |
|
39 |
-
|
40 |
</div>
|
41 |
|
42 |
PySR is built on an extremely optimized pure-Julia backend: [SymbolicRegression.jl](https://github.com/MilesCranmer/SymbolicRegression.jl).
|
@@ -47,14 +43,13 @@ to find algebraic relations that approximate a dataset.
|
|
47 |
|
48 |
One can also
|
49 |
extend these approaches to higher-dimensional
|
50 |
-
spaces by using a neural network as proxy, as explained in
|
51 |
[2006.11287](https://arxiv.org/abs/2006.11287), where we apply
|
52 |
it to N-body problems. Here, one essentially uses
|
53 |
symbolic regression to convert a neural net
|
54 |
to an analytic equation. Thus, these tools simultaneously present
|
55 |
an explicit and powerful way to interpret deep models.
|
56 |
|
57 |
-
|
58 |
*Backstory:*
|
59 |
|
60 |
Previously, we have used
|
@@ -68,19 +63,18 @@ of this package is to have an open-source symbolic regression tool
|
|
68 |
as efficient as eureqa, while also exposing a configurable
|
69 |
python interface.
|
70 |
|
71 |
-
|
72 |
# Installation
|
73 |
|
74 |
<div align="center">
|
75 |
|
76 |
| pip - **recommended** <br> (works everywhere) | conda <br>(Linux and Intel-based macOS) | docker <br>(if all else fails) |
|
77 |
|---|---|---|
|
78 |
-
| 1. [Install Julia](https://julialang.org/downloads/)<br>2. Then, run: `pip install -U pysr`<br>3. Finally, to install Julia packages:<br>`
|
79 |
|
80 |
</div>
|
81 |
|
82 |
Common issues tend to be related to Python not finding Julia.
|
83 |
-
To debug this, try running `
|
84 |
If none of these folders contain your Julia binary, then you need to add Julia's `bin` folder to your `PATH` environment variable.
|
85 |
|
86 |
**Running PySR on macOS with an M1 processor:** you should use the pip version, and make sure to get the Julia binary for ARM/M-series processors.
|
@@ -136,7 +130,7 @@ model.fit(X, y)
|
|
136 |
|
137 |
Internally, this launches a Julia process which will do a multithreaded search for equations to fit the dataset.
|
138 |
|
139 |
-
Equations will be printed during training, and once you are satisfied, you may
|
140 |
quit early by hitting 'q' and then \<enter\>.
|
141 |
|
142 |
After the model has been fit, you can run `model.predict(X)`
|
@@ -167,9 +161,9 @@ This arrow in the `pick` column indicates which equation is currently selected b
|
|
167 |
`model_selection` strategy for prediction.
|
168 |
(You may change `model_selection` after `.fit(X, y)` as well.)
|
169 |
|
170 |
-
`model.equations_` is a pandas DataFrame containing all equations, including callable format
|
171 |
(`lambda_format`),
|
172 |
-
SymPy format (`sympy_format` - which you can also get with `model.sympy()`), and even JAX and PyTorch format
|
173 |
(both of which are differentiable - which you can get with `model.jax()` and `model.pytorch()`).
|
174 |
|
175 |
Note that `PySRRegressor` stores the state of the last search, and will restart from where you left off the next time you call `.fit()`, assuming you have set `warm_start=True`.
|
@@ -181,7 +175,7 @@ You may load the model from the `pkl` file with:
|
|
181 |
|
182 |
```python
|
183 |
model = PySRRegressor.from_file("hall_of_fame.2022-08-10_100832.281.pkl")
|
184 |
-
```
|
185 |
|
186 |
There are several other useful features such as denoising (e.g., `denoising=True`),
|
187 |
feature selection (e.g., `select_k_features=3`).
|
|
|
8 |
|
9 |
</div>
|
10 |
|
|
|
11 |
PySR uses evolutionary algorithms to search for symbolic expressions which optimize a particular objective.
|
12 |
|
13 |
<div align="center">
|
|
|
18 |
|
19 |
</div>
|
20 |
|
|
|
21 |
(pronounced like *py* as in python, and then *sur* as in surface)
|
22 |
|
23 |
If you find PySR useful, please cite it using the citation information given in [CITATION.md](https://github.com/MilesCranmer/PySR/blob/master/CITATION.md).
|
24 |
If you've finished a project with PySR, please submit a PR to showcase your work on the [Research Showcase page](https://astroautomata.com/PySR/papers)!
|
25 |
|
|
|
26 |
<div align="center">
|
27 |
|
28 |
### Test status
|
|
|
30 |
| **Linux** | **Windows** | **macOS (intel)** |
|
31 |
|---|---|---|
|
32 |
|[![Linux](https://github.com/MilesCranmer/PySR/actions/workflows/CI.yml/badge.svg)](https://github.com/MilesCranmer/PySR/actions/workflows/CI.yml)|[![Windows](https://github.com/MilesCranmer/PySR/actions/workflows/CI_Windows.yml/badge.svg)](https://github.com/MilesCranmer/PySR/actions/workflows/CI_Windows.yml)|[![macOS](https://github.com/MilesCranmer/PySR/actions/workflows/CI_mac.yml/badge.svg)](https://github.com/MilesCranmer/PySR/actions/workflows/CI_mac.yml)|
|
33 |
+
| **Docker** | **Conda** | **Coverage** |
|
34 |
|[![Docker](https://github.com/MilesCranmer/PySR/actions/workflows/CI_docker.yml/badge.svg)](https://github.com/MilesCranmer/PySR/actions/workflows/CI_docker.yml)|[![conda-forge](https://github.com/MilesCranmer/PySR/actions/workflows/CI_conda_forge.yml/badge.svg)](https://github.com/MilesCranmer/PySR/actions/workflows/CI_conda_forge.yml)|[![Coverage Status](https://coveralls.io/repos/github/MilesCranmer/PySR/badge.svg?branch=master&service=github)](https://coveralls.io/github/MilesCranmer/PySR)|
|
35 |
|
|
|
36 |
</div>
|
37 |
|
38 |
PySR is built on an extremely optimized pure-Julia backend: [SymbolicRegression.jl](https://github.com/MilesCranmer/SymbolicRegression.jl).
|
|
|
43 |
|
44 |
One can also
|
45 |
extend these approaches to higher-dimensional
|
46 |
+
spaces by using a neural network as proxy, as explained in
|
47 |
[2006.11287](https://arxiv.org/abs/2006.11287), where we apply
|
48 |
it to N-body problems. Here, one essentially uses
|
49 |
symbolic regression to convert a neural net
|
50 |
to an analytic equation. Thus, these tools simultaneously present
|
51 |
an explicit and powerful way to interpret deep models.
|
52 |
|
|
|
53 |
*Backstory:*
|
54 |
|
55 |
Previously, we have used
|
|
|
63 |
as efficient as eureqa, while also exposing a configurable
|
64 |
python interface.
|
65 |
|
|
|
66 |
# Installation
|
67 |
|
68 |
<div align="center">
|
69 |
|
70 |
| pip - **recommended** <br> (works everywhere) | conda <br>(Linux and Intel-based macOS) | docker <br>(if all else fails) |
|
71 |
|---|---|---|
|
72 |
+
| 1. [Install Julia](https://julialang.org/downloads/)<br>2. Then, run: `pip install -U pysr`<br>3. Finally, to install Julia packages:<br>`python3 -c 'import pysr; pysr.install()'` | `conda install -c conda-forge pysr` | 1. Clone this repo.<br>2. `docker build -t pysr .`<br>Run with:<br>`docker run -it --rm pysr ipython`
|
73 |
|
74 |
</div>
|
75 |
|
76 |
Common issues tend to be related to Python not finding Julia.
|
77 |
+
To debug this, try running `python3 -c 'import os; print(os.environ["PATH"])'`.
|
78 |
If none of these folders contain your Julia binary, then you need to add Julia's `bin` folder to your `PATH` environment variable.
|
79 |
|
80 |
**Running PySR on macOS with an M1 processor:** you should use the pip version, and make sure to get the Julia binary for ARM/M-series processors.
|
|
|
130 |
|
131 |
Internally, this launches a Julia process which will do a multithreaded search for equations to fit the dataset.
|
132 |
|
133 |
+
Equations will be printed during training, and once you are satisfied, you may
|
134 |
quit early by hitting 'q' and then \<enter\>.
|
135 |
|
136 |
After the model has been fit, you can run `model.predict(X)`
|
|
|
161 |
`model_selection` strategy for prediction.
|
162 |
(You may change `model_selection` after `.fit(X, y)` as well.)
|
163 |
|
164 |
+
`model.equations_` is a pandas DataFrame containing all equations, including callable format
|
165 |
(`lambda_format`),
|
166 |
+
SymPy format (`sympy_format` - which you can also get with `model.sympy()`), and even JAX and PyTorch format
|
167 |
(both of which are differentiable - which you can get with `model.jax()` and `model.pytorch()`).
|
168 |
|
169 |
Note that `PySRRegressor` stores the state of the last search, and will restart from where you left off the next time you call `.fit()`, assuming you have set `warm_start=True`.
|
|
|
175 |
|
176 |
```python
|
177 |
model = PySRRegressor.from_file("hall_of_fame.2022-08-10_100832.281.pkl")
|
178 |
+
```
|
179 |
|
180 |
There are several other useful features such as denoising (e.g., `denoising=True`),
|
181 |
feature selection (e.g., `select_k_features=3`).
|