报道正文
本文目录6 个章节
pip install pysrIf you find PySR useful, please cite the paper arXiv:2305.01582. If you've finished a project with PySR, please submit a PR to showcase your work on the research showcase page!
Contents:
Why PySR?
PySR is an open-source tool for Symbolic Regression: a machine learning task where the goal is to find an interpretable symbolic expression that optimizes some objective.
Over a period of several years, PySR has been engineered from the ground up to be (1) as high-performance as possible, (2) as configurable as possible, and (3) easy to use. PySR is developed alongside the Julia library SymbolicRegression.jl, which forms the powerful search engine of PySR. The details of these algorithms are described in the PySR paper.
Symbolic regression works best on low-dimensional datasets, but one can also extend these approaches to higher-dimensional spaces by using "Symbolic Distillation" of Neural Networks, as explained in 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 neural networks.
Installation
You can install PySR with pip or conda:
pip install pysrconda install -c conda-forge pysrJulia dependencies will be installed at first import.
AI Agent Skill
Install the PySR skill to provide your coding agents guidance using PySR as part of a larger agentic loop:
npx skills add astroautomata/PySRAdd --global to install the skill globally.
Docker
</summary>You can also use the Dockerfile to install PySR in a docker container
- Clone this repo.
- Within the repo's directory, build the docker container:
docker build -t pysr .- You can then start the container with an IPython execution with:
docker run -it --rm pysr ipythonFor more details, see the docker section.
</details> <details> <summary>Apptainer
</summary>If you are using PySR on a cluster where you do not have root access,
you can use Apptainer to build a container
instead of Docker. The Apptainer.def file is analogous to the Dockerfile,
and can be built with:
apptainer build --notest pysr.sif Apptainer.defand launched with
apptainer run pysr.sifTroubleshooting
</summary>One issue you might run into can result in a hard crash at import with
a message like "GLIBCXX_... not found". This is due to another one of the Python dependencies
loading an incorrect libstdc++ library. To fix this, you should modify your
LD_LIBRARY_PATH variable to reference the Julia libraries. For example, if the Julia
version of libstdc++.so is located in $HOME/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/lib/julia/
(which likely differs on your system!), you could add:
export LD_LIBRARY_PATH=$HOME/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/lib/julia/:$LD_LIBRARY_PATHto your .bashrc or .zshrc file.
(注:更多技术实现细节与完整 API 文档请查阅原项目 README)