Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.0 backend #748

Merged
merged 92 commits into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
967995b
wip: start importing v1
MilesCranmer Nov 7, 2024
932adf4
docs: update homepage
MilesCranmer Nov 9, 2024
063e437
deps: bump to 1.0.0-beta4
MilesCranmer Nov 9, 2024
cfe90f1
fix: avoid deleting temp dir
MilesCranmer Nov 9, 2024
9733d2a
fix: update to new output format
MilesCranmer Nov 9, 2024
d37aa63
deps: set backend version to 1.0.0
MilesCranmer Nov 17, 2024
c6719d1
chore: hide outputs dir
MilesCranmer Nov 17, 2024
05257dc
fix: behavior of loading from checkpoints
MilesCranmer Nov 17, 2024
80195d8
test: fix latex tests
MilesCranmer Nov 17, 2024
2cfc4a3
test: get more tests working
MilesCranmer Nov 17, 2024
829bb57
deps: bump overall julia requirements
MilesCranmer Nov 17, 2024
04042ef
test: more fixes to test directories
MilesCranmer Nov 17, 2024
1817202
test: clean up version check
MilesCranmer Nov 17, 2024
a271659
test: fix paths in jax test
MilesCranmer Nov 17, 2024
f1f64e6
deps: update default versions for Docker
MilesCranmer Nov 17, 2024
f4a083c
deps: fix SR version
MilesCranmer Nov 17, 2024
a38119c
deps: bump to 1.0.0
MilesCranmer Nov 17, 2024
09b1930
deps: bump backend to 1.0.1
MilesCranmer Nov 22, 2024
0d1da79
fix: missing clearing of `equation_file_contents_`
MilesCranmer Nov 23, 2024
bf15526
chore: ignore mypy cache
MilesCranmer Nov 23, 2024
59ff59a
fix: typing issue for `output_directory_`
MilesCranmer Nov 23, 2024
22e1f9f
feat: start ExpressionOptions integration
MilesCranmer Nov 24, 2024
2608fdd
fix: simplify defaults to true
MilesCranmer Nov 24, 2024
f3d3358
feat: don't fail search if checkpointing fails
MilesCranmer Nov 24, 2024
0f2726c
feat: get TemplateExpression fit working
MilesCranmer Nov 24, 2024
b10f787
feat: add assertions
MilesCranmer Nov 24, 2024
d3503f5
docs: document `expression_options`
MilesCranmer Nov 24, 2024
39b5823
refactor: have default expression_options be None
MilesCranmer Nov 24, 2024
5b43b0f
deps: bump backend to 1.0.2
MilesCranmer Nov 24, 2024
20e5eef
deps: bump min julia version
MilesCranmer Nov 24, 2024
f905012
test: fix mypy error
MilesCranmer Nov 24, 2024
73f3af6
refactor: avoid duplicate code
MilesCranmer Nov 24, 2024
17971cc
refactor: rename expression options to expression specs
MilesCranmer Nov 24, 2024
688be6b
feat: add interface methods for declaring sympy/latex/jax/torch support
MilesCranmer Nov 24, 2024
1eebc08
refactor: move out julia expression code
MilesCranmer Nov 24, 2024
b05f8ab
feat: ensure `predict` uses same dtype as fit
MilesCranmer Nov 24, 2024
02613da
feat: introduce `ParametricExpressionSpec`
MilesCranmer Nov 24, 2024
492ae57
test: fix mypy errors
MilesCranmer Nov 25, 2024
4bada83
refactor: clean up redundant lines
MilesCranmer Nov 25, 2024
1196b76
refactor: more type stubs
MilesCranmer Nov 25, 2024
eea8900
refactor: add more typing information
MilesCranmer Nov 25, 2024
82eef25
refactor: further improvements to typing
MilesCranmer Nov 25, 2024
78b3b0a
refactor: reduce julia compilation
MilesCranmer Nov 26, 2024
93f9df7
test: TemplateExpressionSpec for out-of-domain data
MilesCranmer Nov 26, 2024
58b429a
test: clean up TemplateExpressionSpec test
MilesCranmer Nov 26, 2024
f433789
test: ParametricExpressionSpec pipeline test
MilesCranmer Nov 26, 2024
3fd937d
test: rename to `test_main.py` for pytest compat
MilesCranmer Nov 28, 2024
959dfdb
deps: require Python >= 3.9
MilesCranmer Nov 28, 2024
2e75f4e
test: require pytest in dev deps
MilesCranmer Nov 28, 2024
62865b6
fix: TypeAlias definition on older Python
MilesCranmer Nov 28, 2024
713d3c6
fix: only convert dtype for Julia evaluations
MilesCranmer Nov 28, 2024
baa953d
deps: add back typing-extensions
MilesCranmer Nov 28, 2024
b2fe574
test: fix mypy errors
MilesCranmer Nov 28, 2024
c2cbbfc
test: improve coverage for new 1.0 code
MilesCranmer Nov 28, 2024
9fabec6
feat: get complexity_mapping working
MilesCranmer Nov 28, 2024
0b4f6d4
docs: push to new url
MilesCranmer Nov 28, 2024
a12c12e
deps: update backend
MilesCranmer Nov 28, 2024
238cdfb
feat: add missing hyperparams
MilesCranmer Nov 28, 2024
cc0728c
feat!: update all hyperparameters
MilesCranmer Nov 28, 2024
878d2da
feat!: introduce `parallelism` parameter instead of `multithreading`
MilesCranmer Nov 28, 2024
427f092
test: update test for `random_state` test
MilesCranmer Nov 28, 2024
e07ce3d
test: update tests to new parallelism syntax
MilesCranmer Nov 29, 2024
1e432e5
docs: avoid mentioning procs
MilesCranmer Nov 29, 2024
52ef676
test: help mypy
MilesCranmer Nov 29, 2024
94ef0bc
docs: suggest maxsize=20 in README
MilesCranmer Nov 29, 2024
88964b2
chore: move dependencies to pyproject.toml
MilesCranmer Nov 29, 2024
2df313b
deps: create optional deps under `dev`
MilesCranmer Nov 29, 2024
d1927bf
ci: enable beartype checking
MilesCranmer Nov 29, 2024
aa8fda8
refactor: incorporate PEP 585
MilesCranmer Nov 29, 2024
e216da8
fix: dockerfile requirements
MilesCranmer Nov 29, 2024
c2e7d33
ci: separate beartype test
MilesCranmer Nov 29, 2024
1eadf50
test: fix some beartype-identified errors
MilesCranmer Nov 29, 2024
147432b
test: fix jax mapping test
MilesCranmer Nov 30, 2024
c5404f8
deps: require Python >= 3.10
MilesCranmer Nov 30, 2024
95fb9d1
deps: fix pyjuliacall version
MilesCranmer Nov 30, 2024
762d8f9
test: fix type annotation
MilesCranmer Nov 30, 2024
9e87e03
ci: tweak conda backend
MilesCranmer Nov 30, 2024
324d1f6
refactor: more typing info
MilesCranmer Nov 30, 2024
4dc4e6f
docs: add example with template expression
MilesCranmer Nov 30, 2024
2f2fba5
feat: introduce `autodiff_backend`
MilesCranmer Nov 30, 2024
5d154a1
refactor: removed deprecated pythoncall commands
MilesCranmer Nov 30, 2024
7a1cd8a
feat: create `TensorBoardLoggerSpec`
MilesCranmer Nov 30, 2024
23de621
feat: tweak defaults of TensorBoardLoggerSpec
MilesCranmer Nov 30, 2024
5690c4e
refactor: use name `logger_spec` instead of `logger`
MilesCranmer Nov 30, 2024
8eb512a
feat: log hyperparams in tensorboard
MilesCranmer Nov 30, 2024
2c1c8ed
chore: add tensorboard to dev env
MilesCranmer Nov 30, 2024
a5161fc
test: tensorboard logger spec
MilesCranmer Nov 30, 2024
84cb12e
docs: document logger specifications
MilesCranmer Nov 30, 2024
be9f9d8
chore: tweak coverage settings
MilesCranmer Nov 30, 2024
c7b63a3
docs: add to param groupings
MilesCranmer Nov 30, 2024
f16f39e
test: fix mypy errors
MilesCranmer Nov 30, 2024
0aaf3b9
test: skip tensorboard test on windows
MilesCranmer Nov 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 38 additions & 23 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
os: [ubuntu-latest]
test-id: [main]
include:
- julia-version: '1.6'
python-version: '3.8'
- julia-version: '1.10'
python-version: '3.10'
os: ubuntu-latest
test-id: include
- julia-version: '1'
Expand All @@ -58,26 +58,18 @@ jobs:
- name: "Install PySR"
run: |
python -m pip install --upgrade pip
pip install .
pip install '.[dev]'
python -c 'import pysr'
- name: "Assert Julia version"
if: ${{ matrix.julia-version != '1'}}
run: python3 -c "from pysr import jl; assert jl.VERSION.major == jl.seval('v\"${{ matrix.julia-version }}\"').major; assert jl.VERSION.minor == jl.seval('v\"${{ matrix.julia-version }}\"').minor"
- name: "Install test dependencies"
run: pip install coverage coveralls pytest nbval
- name: "Set up coverage for subprocesses"
run: echo 'import coverage; coverage.process_startup()' > "${{ github.workspace }}/sitecustomize.py"
- name: "Run tests"
run: coverage run -m pysr test main,cli,startup
- name: "Install JAX"
run: pip install jax jaxlib # (optional import)
if: ${{ matrix.test-id == 'main' }}
- name: "Run JAX tests"
run: coverage run --append -m pysr test jax
if: ${{ matrix.test-id == 'main' }}
- name: "Install Torch"
run: pip install torch # (optional import)
if: ${{ matrix.test-id == 'main' }}
- name: "Run Torch tests"
run: coverage run --append -m pysr test torch
if: ${{ matrix.test-id == 'main' }}
Expand All @@ -97,15 +89,15 @@ jobs:
julia-version: ['1']
include:
- os: ubuntu-latest
python-version: '3.8'
julia-version: '1.6'
python-version: '3.10'
julia-version: '1.10'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: "Install PySR"
run: |
python -m pip install --upgrade pip
pip install .
pip install '.[dev]'
- name: "Run development test"
run: PYSR_TEST_JULIA_VERSION=${{ matrix.julia-version }} PYSR_TEST_PYTHON_VERSION=${{ matrix.python-version }} python -m pysr test dev

Expand All @@ -131,7 +123,7 @@ jobs:
- name: "Set up Conda"
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-variant: Miniforge3
miniforge-version: latest
auto-activate-base: true
python-version: ${{ matrix.python-version }}
Expand Down Expand Up @@ -176,7 +168,7 @@ jobs:
matrix:
python-version:
- '3.12'
- '3.8'
- '3.10'
os: ['ubuntu-latest']

steps:
Expand All @@ -189,14 +181,37 @@ jobs:
- name: "Install PySR and all dependencies"
run: |
python -m pip install --upgrade pip
pip install .
pip install mypy
- name: "Install additional dependencies"
run: python -m pip install jax jaxlib torch
if: ${{ matrix.python-version != '3.8' }}
pip install '.[dev]'
- name: "Run mypy"
run: python -m mypy --install-types --non-interactive pysr
if: ${{ matrix.python-version != '3.8' }}
if: ${{ matrix.python-version != '3.10' }}
- name: "Run compatible mypy"
run: python -m mypy --ignore-missing-imports pysr
if: ${{ matrix.python-version == '3.8' }}
if: ${{ matrix.python-version == '3.10' }}

beartype:
name: Test with beartype
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
PYSR_USE_BEARTYPE: "1"
strategy:
matrix:
python-version: ['3.12']
os: ['ubuntu-latest']

steps:
- uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: "Install PySR and all dependencies"
run: |
python -m pip install --upgrade pip
pip install '.[dev]'
- name: "Run tests"
run: python -m pysr test main,jax,torch
3 changes: 1 addition & 2 deletions .github/workflows/CI_Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ jobs:
- name: "Install PySR"
run: |
python -m pip install --upgrade pip
pip install pytest nbval "numpy<2.0.0"
pip install .
pip install '.[dev]'
python -c 'import pysr'
- name: "Run tests"
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/CI_conda_forge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12']
os: ['ubuntu-latest']
use-mamba: [true, false]
include:
- python-version: 3.9
- python-version: 3.10
os: 'windows-latest'
use-mamba: true
- python-version: 3.12
os: 'windows-latest'
use-mamba: true
- python-version: 3.9
- python-version: 3.10
os: 'macos-latest'
use-mamba: true
- python-version: 3.12
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/CI_docker_large_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
strategy:
fail-fast: false
matrix:
julia-version: ['1.6', '1']
python-version: ['3.8', '3.12']
julia-version: ['1.10', '1']
python-version: ['3.10', '3.12']
os: [ubuntu-latest]
arch: ['linux/amd64', 'linux/arm64']

Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/CI_large_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
strategy:
fail-fast: false
matrix:
julia-version: ['1.6', '1.8', '1.10']
python-version: ['3.8', '3.10', '3.12']
julia-version: ['1.10', '1']
python-version: ['3.10', '3.12']
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
Expand All @@ -40,8 +40,7 @@ jobs:
- name: "Install PySR"
run: |
python -m pip install --upgrade pip
pip install pytest nbval
pip install .
pip install '.[dev]'
python -c 'import pysr'
- name: "Assert Julia version"
if: ${{ matrix.julia-version != '1'}}
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/CI_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,12 @@ jobs:
- name: "Install PySR"
run: |
python -m pip install --upgrade pip
pip install pytest nbval
pip install .
pip install '.[dev]'
python -c 'import pysr'
- name: "Run tests"
run: |
python -m pysr test main,cli,startup
- name: "Install JAX"
run: pip install jax jaxlib # (optional import)
- name: "Run JAX tests"
run: python -m pysr test jax
- name: "Install Torch"
run: pip install torch # (optional import)
- name: "Run Torch tests"
run: python -m pysr test torch
17 changes: 15 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,26 @@ jobs:
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.12
cache: pip
- name: "Install packages for docs building"
run: pip install -r docs/requirements.txt
- name: "Install PySR"
run: pip install . && python -c 'import pysr'
- name: "Build API docs"
run: cd docs && ./gen_docs.sh
- name: "Deploy documentation"
- name: "Deploy documentation to primary repository"
run: mkdocs gh-deploy --force
- name: "Deploy documentation to secondary repository"
env:
DEPLOY_KEY: ${{ secrets.DAMTP_DEPLOY_KEY }}
run: |
# Set up SSH key for authentication
mkdir -p ~/.ssh
echo "$DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts

git checkout gh-pages
git remote add secondary git@github.com:ai-damtp-cam-ac-uk/pysr.git
git push secondary gh-pages --force
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ site
venv
requirements-dev.lock
requirements.lock
outputs
.mypy_cache
5 changes: 2 additions & 3 deletions Apptainer.def
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Build an Apptainer SIF file containing a working copy of PySR and its prereqs
Bootstrap: docker
From: julia:1.10.4-bullseye
From: julia:1.11.1-bullseye
Stage: jl

Bootstrap: docker
From: python:3.12-bullseye
From: python:3.12.6-bullseye
Stage: runtime

%environment
Expand All @@ -19,7 +19,6 @@ Stage: runtime
/usr/local/julia /usr/local/julia

%files
./requirements.txt /pysr/requirements.txt
./pyproject.toml /pysr/pyproject.toml
./setup.py /pysr/setup.py
./pysr /pysr/pysr
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In this guide you will get an overview of the contribution workflow from opening

## New contributor guide

To get an overview of the project, read PySR's [README](README.md). The [PySR docs](https://astroautomata.com/PySR/) give additional information.
To get an overview of the project, read PySR's [README](README.md). The [PySR docs](https://ai.damtp.cam.ac.uk/pysr/) give additional information.
Here are some resources to help you get started with open source contributions in general:

- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
Expand Down Expand Up @@ -39,7 +39,7 @@ Scan through our [existing issues](https://github.com/MilesCranmer/PySR/issues)
2. Create a working branch and start with your changes!

3. (Optional) If you would like to make changes to PySR itself, skip to step 4. However, if you are interested in making changes to the _symbolic regression code_ itself,
check out the [guide](https://astroautomata.com/PySR/backend/) on modifying a custom SymbolicRegression.jl library.
check out the [guide](https://ai.damtp.cam.ac.uk/pysr/backend/) on modifying a custom SymbolicRegression.jl library.
In this case, you might instead be interested in making suggestions to the [SymbolicRegression.jl](http://github.com/MilesCranmer/SymbolicRegression.jl) library.

4. You can install your local version of PySR with `python setup.py install`, and run tests with `python -m pysr test main`.
Expand Down
8 changes: 2 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# This builds a dockerfile containing a working copy of PySR
# with all pre-requisites installed.

ARG JLVERSION=1.10.4
ARG PYVERSION=3.12.2
ARG JLVERSION=1.11.1
ARG PYVERSION=3.12.6
ARG BASE_IMAGE=bullseye

FROM julia:${JLVERSION}-${BASE_IMAGE} AS jl
Expand All @@ -17,10 +17,6 @@

WORKDIR /pysr

# Caches install (https://stackoverflow.com/questions/25305788/how-to-avoid-reinstalling-packages-when-building-docker-image-for-python-project)
ADD ./requirements.txt /pysr/requirements.txt
RUN pip3 install --no-cache-dir -r /pysr/requirements.txt

# Install PySR:
# We do a minimal copy so it doesn't need to rerun at every file change:
ADD ./pyproject.toml /pysr/pyproject.toml
Expand All @@ -32,8 +28,8 @@
RUN python3 -c 'import pysr; pysr.load_all_packages()'

# metainformation
LABEL org.opencontainers.image.authors = "Miles Cranmer"

Check warning on line 31 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker (ubuntu-latest, linux/amd64, 3.12.3, 1.10.3)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "LABEL key=value" should be used instead of legacy "LABEL key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
LABEL org.opencontainers.image.source = "https://github.com/MilesCranmer/PySR"

Check warning on line 32 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker (ubuntu-latest, linux/amd64, 3.12.3, 1.10.3)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "LABEL key=value" should be used instead of legacy "LABEL key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/
LABEL org.opencontainers.image.licenses = "Apache License 2.0"

Check warning on line 33 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker (ubuntu-latest, linux/amd64, 3.12.3, 1.10.3)

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "LABEL key=value" should be used instead of legacy "LABEL key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

CMD ["ipython"]
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ https://github.com/MilesCranmer/PySR/assets/7593028/c8511a49-b408-488f-8f18-b174

| **Docs** | **Forums** | **Paper** | **colab demo** |
|:---:|:---:|:---:|:---:|
|[![Documentation](https://github.com/MilesCranmer/PySR/actions/workflows/docs.yml/badge.svg)](https://astroautomata.com/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)|
|[![Documentation](https://github.com/MilesCranmer/PySR/actions/workflows/docs.yml/badge.svg)](https://ai.damtp.cam.ac.uk/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)|

| **pip** | **conda** | **Stats** |
| :---: | :---: | :---: |
Expand All @@ -20,14 +20,14 @@ https://github.com/MilesCranmer/PySR/assets/7593028/c8511a49-b408-488f-8f18-b174
</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)!
If you've finished a project with PySR, please submit a PR to showcase your work on the [research showcase page](https://ai.damtp.cam.ac.uk/pysr/papers)!

**Contents**:

- [Why PySR?](#why-pysr)
- [Installation](#installation)
- [Quickstart](#quickstart)
- [→ Documentation](https://astroautomata.com/PySR)
- [→ Documentation](https://ai.damtp.cam.ac.uk/PySR)
- [Contributors](#contributors-)

<div align="center">
Expand Down Expand Up @@ -178,6 +178,7 @@ PySR's main interface is in the style of scikit-learn:
from pysr import PySRRegressor

model = PySRRegressor(
maxsize=20,
niterations=40, # < Increase me for better results
binary_operators=["+", "*"],
unary_operators=[
Expand Down Expand Up @@ -254,22 +255,21 @@ model = PySRRegressor.from_file("hall_of_fame.2022-08-10_100832.281.pkl")

There are several other useful features such as denoising (e.g., `denoise=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).
For examples of these and other features, see the [examples page](https://ai.damtp.cam.ac.uk/pysr/examples).
For a detailed look at more options, see the [options page](https://ai.damtp.cam.ac.uk/pysr/options).
You can also see the full API at [this page](https://ai.damtp.cam.ac.uk/pysr/api).
There are also tips for tuning PySR on [this page](https://ai.damtp.cam.ac.uk/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/).
For details on what each parameter does, check out the [API page](https://ai.damtp.cam.ac.uk/pysr/api/).

```python
model = PySRRegressor(
procs=4,
populations=8,
# ^ 2 populations per core, so one is always running.
# ^ Assuming we have 4 cores, this means 2 populations per core, so one is always running.
population_size=50,
# ^ Slightly larger populations, for greater diversity.
ncycles_per_iteration=500,
Expand Down
Loading
Loading