Spaces:
Running
Running
File size: 33,636 Bytes
c3da359 18c1f9c 901f043 e66aef0 a783eda b5f33d5 ae6214c bd4632a 901f043 b5f33d5 43bfe9e 18c1f9c b2513ce 5835f22 38b3ddc 5835f22 38b3ddc 367a8d9 38b3ddc 367a8d9 38b3ddc 367a8d9 38b3ddc 5835f22 4d9bd75 18c1f9c 8c0122a 18c1f9c a203770 cf5c437 e881315 cf5c437 cf8bf07 18c1f9c 162cbb5 025ed0e e987d40 e881315 10e246a e987d40 49c1f08 e987d40 49c1f08 3f60d16 dc9d777 8c58028 3f60d16 b5f33d5 3f60d16 0afdc3f 3f60d16 b5f33d5 3f60d16 b5f33d5 3f60d16 b5f33d5 3f60d16 b5f33d5 3f60d16 b5f33d5 3f60d16 b5f33d5 3f60d16 18c1f9c c59adef e881315 c59adef c0da614 dc1a4e7 b836a83 3f60d16 502bd82 f5d41d2 25164ef f5d41d2 296ee04 ecc127c 925dcc4 fadf4db 296ee04 fadf4db ecc127c fadf4db 296ee04 fadf4db 5969aa3 fadf4db 296ee04 925dcc4 53256e6 925dcc4 fadf4db 7b75cd8 296ee04 925dcc4 7b75cd8 d0ea029 7b75cd8 925dcc4 ecc127c 296ee04 b7b7f87 ecc127c fadf4db 296ee04 59cf3d0 fadf4db ecc127c 296ee04 fadf4db ecc127c e881315 fadf4db 773f98b fadf4db 3af12da 773f98b fadf4db 296ee04 59cf3d0 fadf4db 59cf3d0 296ee04 bb97e2c 296ee04 59cf3d0 3c8d9b9 b5f33d5 fadf4db 59cf3d0 296ee04 fadf4db e881315 fadf4db e881315 4383c36 fadf4db 9433a83 296ee04 9433a83 e881315 7ab053d bb97e2c fe3d590 fb2bd3f 5908dc9 3f60d16 74541ce 1914007 5276a81 74541ce 282a715 74541ce 0e8b257 6c3fb57 74541ce 6c3fb57 74541ce 3f60d16 fadf4db 296ee04 fadf4db a2ee961 fadf4db 296ee04 9074ab0 c9f1ebd 296ee04 fadf4db 296ee04 fadf4db 8b9896b ee2d4ea |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
[//]: # (Logo:)
<div align="center">
PySR searches for symbolic expressions which optimize a particular objective.
<https://github.com/MilesCranmer/PySR/assets/7593028/c8511a49-b408-488f-8f18-b1749078268f>
# PySR: High-Performance Symbolic Regression in Python and Julia
| **Docs** | **pip** | **Forums** | **Paper** | **colab demo** |
|:---:|:---:|:---:|:---:|:---:|
|[![Documentation](https://github.com/MilesCranmer/PySR/actions/workflows/docs.yml/badge.svg)](https://astroautomata.com/PySR/)|[![PyPI version](https://badge.fury.io/py/pysr.svg)](https://badge.fury.io/py/pysr)|[![Discussions](https://img.shields.io/badge/discussions-github-informational)](https://github.com/MilesCranmer/PySR/discussions)|[![Paper](https://img.shields.io/badge/arXiv-2305.01582-b31b1b)](https://arxiv.org/abs/2305.01582)|[![Colab](https://img.shields.io/badge/colab-notebook-yellow)](https://colab.research.google.com/github/MilesCranmer/PySR/blob/master/examples/pysr_demo.ipynb)|
</div>
If you find PySR useful, please cite the paper [arXiv:2305.01582](https://arxiv.org/abs/2305.01582).
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)!
<div align="center">
### Contributors β¨
</div>
We are eager to welcome new contributors and are looking forward to get you up to speed! Check out our contributors [guide](https://github.com/MilesCranmer/PySR/blob/master/CONTRIBUTORS.md) for tips π.
If you have an idea for a new feature, don't hesitate to share it on the [issues](https://github.com/MilesCranmer/PySR/issues) or [discussions](https://github.com/MilesCranmer/PySR/discussions) page.
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="12.5%"><a href="https://www.linkedin.com/in/markkittisopikul/"><img src="https://avatars.githubusercontent.com/u/8062771?v=4?s=50" width="50px;" alt="Mark Kittisopikul"/><br /><sub><b>Mark Kittisopikul</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/commits?author=mkitti" title="Code">π»</a> <a href="#ideas-mkitti" title="Ideas, planning, and feedback.">π‘</a> <a href="#infra-mkitti" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#platform-mkitti" title="Packaging/porting to new platform">π¦</a> <a href="#promotion-mkitti" title="Promotion">π£</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3Amkitti" title="Reviewed Pull Requests">π</a> <a href="#tool-mkitti" title="Tools">π§</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=mkitti" title="Tests">β οΈ</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/tttc3"><img src="https://avatars.githubusercontent.com/u/97948946?v=4?s=50" width="50px;" alt="T Coxon"/><br /><sub><b>T Coxon</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3Atttc3" title="Bug reports">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=tttc3" title="Code">π»</a> <a href="#plugin-tttc3" title="Plugin/utility libraries">π</a> <a href="#ideas-tttc3" title="Ideas, planning, and feedback.">π‘</a> <a href="#infra-tttc3" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#maintenance-tttc3" title="Maintenance">π§</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3Atttc3" title="Reviewed Pull Requests">π</a> <a href="#tool-tttc3" title="Tools">π§</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=tttc3" title="Tests">β οΈ</a> <a href="#userTesting-tttc3" title="User Testing">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/DhananjayAshok"><img src="https://avatars.githubusercontent.com/u/46792537?v=4?s=50" width="50px;" alt="Dhananjay Ashok"/><br /><sub><b>Dhananjay Ashok</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/commits?author=DhananjayAshok" title="Code">π»</a> <a href="#example-DhananjayAshok" title="Examples.">π</a> <a href="#ideas-DhananjayAshok" title="Ideas, planning, and feedback.">π‘</a> <a href="#maintenance-DhananjayAshok" title="Maintenance">π§</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=DhananjayAshok" title="Tests">β οΈ</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://gitlab.com/johanbluecreek"><img src="https://avatars.githubusercontent.com/u/852554?v=4?s=50" width="50px;" alt="Johan BlΓ₯bΓ€ck"/><br /><sub><b>Johan BlΓ₯bΓ€ck</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3Ajohanbluecreek" title="Bug reports">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=johanbluecreek" title="Code">π»</a> <a href="#ideas-johanbluecreek" title="Ideas, planning, and feedback.">π‘</a> <a href="#maintenance-johanbluecreek" title="Maintenance">π§</a> <a href="#promotion-johanbluecreek" title="Promotion">π£</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3Ajohanbluecreek" title="Reviewed Pull Requests">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=johanbluecreek" title="Tests">β οΈ</a> <a href="#userTesting-johanbluecreek" title="User Testing">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://mathopt.de/people/martensen/index.php"><img src="https://avatars.githubusercontent.com/u/20998300?v=4?s=50" width="50px;" alt="JuliusMartensen"/><br /><sub><b>JuliusMartensen</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3AAlCap23" title="Bug reports">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=AlCap23" title="Code">π»</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=AlCap23" title="Documentation">π</a> <a href="#plugin-AlCap23" title="Plugin/utility libraries">π</a> <a href="#ideas-AlCap23" title="Ideas, planning, and feedback.">π‘</a> <a href="#infra-AlCap23" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#maintenance-AlCap23" title="Maintenance">π§</a> <a href="#platform-AlCap23" title="Packaging/porting to new platform">π¦</a> <a href="#promotion-AlCap23" title="Promotion">π£</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3AAlCap23" title="Reviewed Pull Requests">π</a> <a href="#tool-AlCap23" title="Tools">π§</a> <a href="#userTesting-AlCap23" title="User Testing">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/ngam"><img src="https://avatars.githubusercontent.com/u/67342040?v=4?s=50" width="50px;" alt="ngam"/><br /><sub><b>ngam</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/commits?author=ngam" title="Code">π»</a> <a href="#infra-ngam" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#platform-ngam" title="Packaging/porting to new platform">π¦</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3Angam" title="Reviewed Pull Requests">π</a> <a href="#tool-ngam" title="Tools">π§</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=ngam" title="Tests">β οΈ</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/kazewong"><img src="https://avatars.githubusercontent.com/u/8803931?v=4?s=50" width="50px;" alt="Kaze Wong"/><br /><sub><b>Kaze Wong</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3Akazewong" title="Bug reports">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=kazewong" title="Code">π»</a> <a href="#ideas-kazewong" title="Ideas, planning, and feedback.">π‘</a> <a href="#infra-kazewong" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#maintenance-kazewong" title="Maintenance">π§</a> <a href="#promotion-kazewong" title="Promotion">π£</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3Akazewong" title="Reviewed Pull Requests">π</a> <a href="#research-kazewong" title="Research">π¬</a> <a href="#userTesting-kazewong" title="User Testing">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/ChrisRackauckas"><img src="https://avatars.githubusercontent.com/u/1814174?v=4?s=50" width="50px;" alt="Christopher Rackauckas"/><br /><sub><b>Christopher Rackauckas</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3AChrisRackauckas" title="Bug reports">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=ChrisRackauckas" title="Code">π»</a> <a href="#plugin-ChrisRackauckas" title="Plugin/utility libraries">π</a> <a href="#ideas-ChrisRackauckas" title="Ideas, planning, and feedback.">π‘</a> <a href="#infra-ChrisRackauckas" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="#promotion-ChrisRackauckas" title="Promotion">π£</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3AChrisRackauckas" title="Reviewed Pull Requests">π</a> <a href="#research-ChrisRackauckas" title="Research">π¬</a> <a href="#tool-ChrisRackauckas" title="Tools">π§</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=ChrisRackauckas" title="Tests">β οΈ</a> <a href="#userTesting-ChrisRackauckas" title="User Testing">π</a></td>
</tr>
<tr>
<td align="center" valign="top" width="12.5%"><a href="https://kidger.site/"><img src="https://avatars.githubusercontent.com/u/33688385?v=4?s=50" width="50px;" alt="Patrick Kidger"/><br /><sub><b>Patrick Kidger</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3Apatrick-kidger" title="Bug reports">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=patrick-kidger" title="Code">π»</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=patrick-kidger" title="Documentation">π</a> <a href="#plugin-patrick-kidger" title="Plugin/utility libraries">π</a> <a href="#ideas-patrick-kidger" title="Ideas, planning, and feedback.">π‘</a> <a href="#maintenance-patrick-kidger" title="Maintenance">π§</a> <a href="#promotion-patrick-kidger" title="Promotion">π£</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3Apatrick-kidger" title="Reviewed Pull Requests">π</a> <a href="#research-patrick-kidger" title="Research">π¬</a> <a href="#tool-patrick-kidger" title="Tools">π§</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=patrick-kidger" title="Tests">β οΈ</a> <a href="#userTesting-patrick-kidger" title="User Testing">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/w2ll2am"><img src="https://avatars.githubusercontent.com/u/16038228?v=4?s=50" width="50px;" alt="William Booth-Clibborn"/><br /><sub><b>William Booth-Clibborn</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/commits?author=w2ll2am" title="Code">π»</a> <a href="#example-w2ll2am" title="Examples.">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=w2ll2am" title="Documentation">π</a> <a href="#userTesting-w2ll2am" title="User Testing">π</a> <a href="#maintenance-w2ll2am" title="Maintenance">π§</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3Aw2ll2am" title="Reviewed Pull Requests">π</a> <a href="#tool-w2ll2am" title="Tools">π§</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=w2ll2am" title="Tests">β οΈ</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://pablo-lemos.github.io/"><img src="https://avatars.githubusercontent.com/u/38078898?v=4?s=50" width="50px;" alt="Pablo Lemos"/><br /><sub><b>Pablo Lemos</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3APablo-Lemos" title="Bug reports">π</a> <a href="#ideas-Pablo-Lemos" title="Ideas, planning, and feedback.">π‘</a> <a href="#promotion-Pablo-Lemos" title="Promotion">π£</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3APablo-Lemos" title="Reviewed Pull Requests">π</a> <a href="#research-Pablo-Lemos" title="Research">π¬</a> <a href="#userTesting-Pablo-Lemos" title="User Testing">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/Moelf"><img src="https://avatars.githubusercontent.com/u/5306213?v=4?s=50" width="50px;" alt="Jerry Ling"/><br /><sub><b>Jerry Ling</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3AMoelf" title="Bug reports">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=Moelf" title="Code">π»</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=Moelf" title="Documentation">π</a> <a href="#example-Moelf" title="Examples.">π</a> <a href="#ideas-Moelf" title="Ideas, planning, and feedback.">π‘</a> <a href="#promotion-Moelf" title="Promotion">π£</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3AMoelf" title="Reviewed Pull Requests">π</a> <a href="#userTesting-Moelf" title="User Testing">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/CharFox1"><img src="https://avatars.githubusercontent.com/u/35052672?v=4?s=50" width="50px;" alt="Charles Fox"/><br /><sub><b>Charles Fox</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3ACharFox1" title="Bug reports">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=CharFox1" title="Code">π»</a> <a href="#ideas-CharFox1" title="Ideas, planning, and feedback.">π‘</a> <a href="#maintenance-CharFox1" title="Maintenance">π§</a> <a href="#promotion-CharFox1" title="Promotion">π£</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3ACharFox1" title="Reviewed Pull Requests">π</a> <a href="#research-CharFox1" title="Research">π¬</a> <a href="#userTesting-CharFox1" title="User Testing">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/johannbrehmer"><img src="https://avatars.githubusercontent.com/u/17068560?v=4?s=50" width="50px;" alt="Johann Brehmer"/><br /><sub><b>Johann Brehmer</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/commits?author=johannbrehmer" title="Code">π»</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=johannbrehmer" title="Documentation">π</a> <a href="#ideas-johannbrehmer" title="Ideas, planning, and feedback.">π‘</a> <a href="#promotion-johannbrehmer" title="Promotion">π£</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3Ajohannbrehmer" title="Reviewed Pull Requests">π</a> <a href="#research-johannbrehmer" title="Research">π¬</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=johannbrehmer" title="Tests">β οΈ</a> <a href="#userTesting-johannbrehmer" title="User Testing">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="http://www.cosmicmar.com/"><img src="https://avatars.githubusercontent.com/u/1510968?v=4?s=50" width="50px;" alt="Marius Millea"/><br /><sub><b>Marius Millea</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/commits?author=marius311" title="Code">π»</a> <a href="#ideas-marius311" title="Ideas, planning, and feedback.">π‘</a> <a href="#promotion-marius311" title="Promotion">π£</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3Amarius311" title="Reviewed Pull Requests">π</a> <a href="#userTesting-marius311" title="User Testing">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://gitlab.com/cobac"><img src="https://avatars.githubusercontent.com/u/27872944?v=4?s=50" width="50px;" alt="Coba"/><br /><sub><b>Coba</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3Acobac" title="Bug reports">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=cobac" title="Code">π»</a> <a href="#ideas-cobac" title="Ideas, planning, and feedback.">π‘</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3Acobac" title="Reviewed Pull Requests">π</a> <a href="#userTesting-cobac" title="User Testing">π</a></td>
</tr>
<tr>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/pitmonticone"><img src="https://avatars.githubusercontent.com/u/38562595?v=4?s=50" width="50px;" alt="Pietro Monticone"/><br /><sub><b>Pietro Monticone</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3Apitmonticone" title="Bug reports">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=pitmonticone" title="Documentation">π</a> <a href="#ideas-pitmonticone" title="Ideas, planning, and feedback.">π‘</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/sheevy"><img src="https://avatars.githubusercontent.com/u/1525683?v=4?s=50" width="50px;" alt="Mateusz Kubica"/><br /><sub><b>Mateusz Kubica</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/commits?author=sheevy" title="Documentation">π</a> <a href="#ideas-sheevy" title="Ideas, planning, and feedback.">π‘</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://jaywadekar.github.io/"><img src="https://avatars.githubusercontent.com/u/5493388?v=4?s=50" width="50px;" alt="Jay Wadekar"/><br /><sub><b>Jay Wadekar</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3AJayWadekar" title="Bug reports">π</a> <a href="#ideas-JayWadekar" title="Ideas, planning, and feedback.">π‘</a> <a href="#promotion-JayWadekar" title="Promotion">π£</a> <a href="#research-JayWadekar" title="Research">π¬</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/Jgmedina95"><img src="https://avatars.githubusercontent.com/u/97254349?v=4?s=50" width="50px;" alt="Jgmedina95"/><br /><sub><b>Jgmedina95</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3AJgmedina95" title="Bug reports">π</a> <a href="#ideas-Jgmedina95" title="Ideas, planning, and feedback.">π‘</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3AJgmedina95" title="Reviewed Pull Requests">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/mcabbott"><img src="https://avatars.githubusercontent.com/u/32575566?v=4?s=50" width="50px;" alt="Michael Abbott"/><br /><sub><b>Michael Abbott</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/commits?author=mcabbott" title="Code">π»</a> <a href="#ideas-mcabbott" title="Ideas, planning, and feedback.">π‘</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3Amcabbott" title="Reviewed Pull Requests">π</a> <a href="#tool-mcabbott" title="Tools">π§</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/oscardssmith"><img src="https://avatars.githubusercontent.com/u/11729272?v=4?s=50" width="50px;" alt="Oscar Smith"/><br /><sub><b>Oscar Smith</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/commits?author=oscardssmith" title="Code">π»</a> <a href="#ideas-oscardssmith" title="Ideas, planning, and feedback.">π‘</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/henriquebecker91"><img src="https://avatars.githubusercontent.com/u/14113435?v=4?s=50" width="50px;" alt="Henrique Becker"/><br /><sub><b>Henrique Becker</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/commits?author=henriquebecker91" title="Code">π»</a> <a href="#ideas-henriquebecker91" title="Ideas, planning, and feedback.">π‘</a> <a href="https://github.com/MilesCranmer/PySR/pulls?q=is%3Apr+reviewed-by%3Ahenriquebecker91" title="Reviewed Pull Requests">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/qwertyjl"><img src="https://avatars.githubusercontent.com/u/110912592?v=4?s=50" width="50px;" alt="qwertyjl"/><br /><sub><b>qwertyjl</b></sub></a><br /><a href="https://github.com/MilesCranmer/PySR/issues?q=author%3Aqwertyjl" title="Bug reports">π</a> <a href="https://github.com/MilesCranmer/PySR/commits?author=qwertyjl" title="Documentation">π</a> <a href="#ideas-qwertyjl" title="Ideas, planning, and feedback.">π‘</a> <a href="#userTesting-qwertyjl" title="User Testing">π</a></td>
</tr>
<tr>
<td align="center" valign="top" width="12.5%"><a href="https://huijzer.xyz/"><img src="https://avatars.githubusercontent.com/u/20724914?v=4?s=50" width="50px;" alt="Rik Huijzer"/><br /><sub><b>Rik Huijzer</b></sub></a><br /><a href="#ideas-rikhuijzer" title="Ideas, planning, and feedback.">π‘</a> <a href="#infra-rikhuijzer" title="Infrastructure (Hosting, Build-Tools, etc)">π</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/GCaptainNemo"><img src="https://avatars.githubusercontent.com/u/43086239?v=4?s=50" width="50px;" alt="Hongyu Wang"/><br /><sub><b>Hongyu Wang</b></sub></a><br /><a href="#ideas-GCaptainNemo" title="Ideas, planning, and feedback.">π‘</a> <a href="#promotion-GCaptainNemo" title="Promotion">π£</a> <a href="#research-GCaptainNemo" title="Research">π¬</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://sauravmaheshkar.github.io/"><img src="https://avatars.githubusercontent.com/u/61241031?v=4?s=50" width="50px;" alt="Saurav Maheshkar"/><br /><sub><b>Saurav Maheshkar</b></sub></a><br /><a href="#tool-SauravMaheshkar" title="Tools">π§</a></td>
</tr>
</tbody>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
<div align="center">
### Test status
| **Linux** | **Windows** | **macOS** |
|---|---|---|
|[![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)|
| **Docker** | **Conda** | **Coverage** |
|[![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)|
</div>
PySR is built on an extremely optimized pure-Julia backend: [SymbolicRegression.jl](https://github.com/MilesCranmer/SymbolicRegression.jl).
Symbolic regression is a very interpretable machine learning algorithm
for low-dimensional problems: these tools search equation space
to find algebraic relations that approximate a dataset.
One can also
extend these approaches to higher-dimensional
spaces by using a neural network as proxy, as explained in
[2006.11287](https://arxiv.org/abs/2006.11287), where we apply
it to N-body problems. Here, one essentially uses
symbolic regression to convert a neural net
to an analytic equation. Thus, these tools simultaneously present
an explicit and powerful way to interpret deep models.
*Backstory:*
Previously, we have used
[eureqa](https://www.creativemachineslab.com/eureqa.html),
which is a very efficient and user-friendly tool. However,
eureqa is GUI-only, doesn't allow for user-defined
operators, has no distributed capabilities,
and has become proprietary (and recently been merged into an online
service). Thus, the goal
of this package is to have an open-source symbolic regression tool
as efficient as eureqa, while also exposing a configurable
python interface.
## Installation
### pip
1. [Install Julia](https://julialang.org/downloads/)
- Alternatively, my personal preference is to use [juliaup](https://github.com/JuliaLang/juliaup#installation), which performs this automatically.
2. Then, run:
```bash
pip3 install -U pysr
```
3. Finally, to install Julia dependencies:
```bash
python3 -m pysr install
```
> (Alternatively, from within Python, you can call `import pysr; pysr.install()`)
---
### docker build
1. Clone this repo.
2. In the repo, run the build command with:
```bash
docker build -t pysr .
```
3. You can then start the container with an IPython execution with:
```bash
docker run -it --rm pysr ipython
```
For more details, see the [docker section](#docker).
---
### Common issues
Common issues tend to be related to Python not finding Julia.
To debug this, try running `python3 -c 'import os; print(os.environ["PATH"])'`.
If none of these folders contain your Julia binary, then you need to add Julia's `bin` folder to your `PATH` environment variable.
**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.
## Introduction
You might wish to try the interactive tutorial [here](https://colab.research.google.com/github/MilesCranmer/PySR/blob/master/examples/pysr_demo.ipynb), which uses the notebook in `examples/pysr_demo.ipynb`.
In practice, I highly recommend using IPython rather than Jupyter, as the printing is much nicer.
Below is a quick demo here which you can paste into a Python runtime.
First, let's import numpy to generate some test data:
```python
import numpy as np
X = 2 * np.random.randn(100, 5)
y = 2.5382 * np.cos(X[:, 3]) + X[:, 0] ** 2 - 0.5
```
We have created a dataset with 100 datapoints, with 5 features each.
The relation we wish to model is $2.5382 \cos(x_3) + x_0^2 - 0.5$.
Now, let's create a PySR model and train it.
PySR's main interface is in the style of scikit-learn:
```python
from pysr import PySRRegressor
model = PySRRegressor(
niterations=40, # < Increase me for better results
binary_operators=["+", "*"],
unary_operators=[
"cos",
"exp",
"sin",
"inv(x) = 1/x",
# ^ Custom operator (julia syntax)
],
extra_sympy_mappings={"inv": lambda x: 1 / x},
# ^ Define operator for SymPy as well
loss="loss(prediction, target) = (prediction - target)^2",
# ^ Custom loss function (julia syntax)
)
```
This will set up the model for 40 iterations of the search code, which contains hundreds of thousands of mutations and equation evaluations.
Let's train this model on our dataset:
```python
model.fit(X, y)
```
Internally, this launches a Julia process which will do a multithreaded search for equations to fit the dataset.
Equations will be printed during training, and once you are satisfied, you may
quit early by hitting 'q' and then \<enter\>.
After the model has been fit, you can run `model.predict(X)`
to see the predictions on a given dataset using the automatically-selected expression,
or, for example, `model.predict(X, 3)` to see the predictions of the 3rd equation.
You may run:
```python
print(model)
```
to print the learned equations:
```python
PySRRegressor.equations_ = [
pick score equation loss complexity
0 0.000000 4.4324794 42.354317 1
1 1.255691 (x0 * x0) 3.437307 3
2 0.011629 ((x0 * x0) + -0.28087974) 3.358285 5
3 0.897855 ((x0 * x0) + cos(x3)) 1.368308 6
4 0.857018 ((x0 * x0) + (cos(x3) * 2.4566472)) 0.246483 8
5 >>>> inf (((cos(x3) + -0.19699033) * 2.5382123) + (x0 *... 0.000000 10
]
```
This arrow in the `pick` column indicates which equation is currently selected by your
`model_selection` strategy for prediction.
(You may change `model_selection` after `.fit(X, y)` as well.)
`model.equations_` is a pandas DataFrame containing all equations, including callable format
(`lambda_format`),
SymPy format (`sympy_format` - which you can also get with `model.sympy()`), and even JAX and PyTorch format
(both of which are differentiable - which you can get with `model.jax()` and `model.pytorch()`).
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`.
This will cause problems if significant changes are made to the search parameters (like changing the operators). You can run `model.reset()` to reset the state.
You will notice that PySR will save two files: `hall_of_fame...csv` and `hall_of_fame...pkl`.
The csv file is a list of equations and their losses, and the pkl file is a saved state of the model.
You may load the model from the `pkl` file with:
```python
model = PySRRegressor.from_file("hall_of_fame.2022-08-10_100832.281.pkl")
```
There are several other useful features such as denoising (e.g., `denoising=True`),
feature selection (e.g., `select_k_features=3`).
For examples of these and other features, see the [examples page](https://astroautomata.com/PySR/examples).
For a detailed look at more options, see the [options page](https://astroautomata.com/PySR/options).
You can also see the full API at [this page](https://astroautomata.com/PySR/api).
There are also tips for tuning PySR on [this page](https://astroautomata.com/PySR/tuning).
### Detailed Example
The following code makes use of as many PySR features as possible.
Note that is just a demonstration of features and you should not use this example as-is.
For details on what each parameter does, check out the [API page](https://astroautomata.com/PySR/api/).
```python
model = PySRRegressor(
procs=4,
populations=8,
# ^ 2 populations per core, so one is always running.
population_size=50,
# ^ Slightly larger populations, for greater diversity.
ncyclesperiteration=500,
# ^ Generations between migrations.
niterations=10000000, # Run forever
early_stop_condition=(
"stop_if(loss, complexity) = loss < 1e-6 && complexity < 10"
# Stop early if we find a good and simple equation
),
timeout_in_seconds=60 * 60 * 24,
# ^ Alternatively, stop after 24 hours have passed.
maxsize=50,
# ^ Allow greater complexity.
maxdepth=10,
# ^ But, avoid deep nesting.
binary_operators=["*", "+", "-", "/"],
unary_operators=["square", "cube", "exp", "cos2(x)=cos(x)^2"],
constraints={
"/": (-1, 9),
"square": 9,
"cube": 9,
"exp": 9,
},
# ^ Limit the complexity within each argument.
# "inv": (-1, 9) states that the numerator has no constraint,
# but the denominator has a max complexity of 9.
# "exp": 9 simply states that `exp` can only have
# an expression of complexity 9 as input.
nested_constraints={
"square": {"square": 1, "cube": 1, "exp": 0},
"cube": {"square": 1, "cube": 1, "exp": 0},
"exp": {"square": 1, "cube": 1, "exp": 0},
},
# ^ Nesting constraints on operators. For example,
# "square(exp(x))" is not allowed, since "square": {"exp": 0}.
complexity_of_operators={"/": 2, "exp": 3},
# ^ Custom complexity of particular operators.
complexity_of_constants=2,
# ^ Punish constants more than variables
select_k_features=4,
# ^ Train on only the 4 most important features
progress=True,
# ^ Can set to false if printing to a file.
weight_randomize=0.1,
# ^ Randomize the tree much more frequently
cluster_manager=None,
# ^ Can be set to, e.g., "slurm", to run a slurm
# cluster. Just launch one script from the head node.
precision=64,
# ^ Higher precision calculations.
warm_start=True,
# ^ Start from where left off.
turbo=True,
# ^ Faster evaluation (experimental)
julia_project=None,
# ^ Can set to the path of a folder containing the
# "SymbolicRegression.jl" repo, for custom modifications.
update=False,
# ^ Don't update Julia packages
extra_sympy_mappings={"cos2": lambda x: sympy.cos(x)**2},
# extra_torch_mappings={sympy.cos: torch.cos},
# ^ Not needed as cos already defined, but this
# is how you define custom torch operators.
# extra_jax_mappings={sympy.cos: "jnp.cos"},
# ^ For JAX, one passes a string.
)
```
## Docker
You can also test out PySR in Docker, without
installing it locally, by running the following command in
the root directory of this repo:
```bash
docker build -t pysr .
```
This builds an image called `pysr` for your system's architecture,
which also contains IPython.
You can then run this with:
```bash
docker run -it --rm -v "$PWD:/data" pysr ipython
```
which will link the current directory to the container's `/data` directory
and then launch ipython.
If you have issues building for your system's architecture,
you can emulate another architecture by including `--platform linux/amd64`,
before the `build` and `run` commands.
|