Releases: MilesCranmer/PySR
v1.0.0
PySR v1.0.0 Release Notes
PySR 1.0.0 introduces new features for imposing specific functional forms and finding parametric expressions. It also includes TensorBoard support, along with significant updates to the core algorithm, including some important bug fixes. The default hyperparameters have also been updated based on extensive tuning, with a maxsize of 30 rather than 20.
Major New Features
Expression Specifications
PySR 1.0.0 introduces new ways to specify the structure of equations through "Expression Specifications", that expose the new backend feature of AbstractExpression
:
Template Expressions
TemplateExpressionSpec
allows you to define a specific structure for your equations. For example:
expression_spec = TemplateExpressionSpec(["f", "g"], "((; f, g), (x1, x2, x3)) -> sin(f(x1, x2)) + g(x3)")
Parametric Expressions
ParametricExpressionSpec
enables fitting expressions that can adapt to different categories of data with per-category parameters:
expression_spec = ParametricExpressionSpec(max_parameters=2)
model = PySRRegressor(
expression_spec=expression_spec
binary_operators=["+", "*", "-", "/"],
)
model.fit(X, y, category=category) # Pass category labels
Improved Logging with TensorBoard
The new TensorBoardLoggerSpec
enables logging of the search process, as well as hyperparameter recording, which exposes the AbstractSRLogger
feature of the backend:
logger_spec = TensorBoardLoggerSpec(
log_dir="logs/run",
log_interval=10, # Log every 10 iterations
)
model = PySRRegressor(logger_spec=logger_spec)
Features logged include:
- Loss curves over time at each complexity level
- Population statistics
- Pareto "volume" logging (measures performance over all complexities with a single scalar)
- The min loss over time
Algorithm Improvements
Updated Default Parameters
The default hyperparameters have been significantly revised based on testing:
- Increased default
maxsize
from 20 to 30, as I noticed that many people use the defaults, and this maxsize would allow for more accurate expressions. - New mutation operator weights optimized for better performance, along the new mutation "rotate tree."
- Improved search parameters tuned using Pareto front volume calculations.
- Default
niterations
increased from 40 to 100, also to support better accuracy (at the expense of slightly longer default search times).
Core Changes
- New output organization: Results are now stored in
outputs/<run_id>/
rather than in the directory of execution. - Improved performance with better parallelism handling
- Support for Python 3.10+
- Updated Julia backend to version 1.10+
- Fix for aliasing issues in crossover operations
Breaking Changes
- Minimum Python version is now 3.10, and minimum Julia version is 1.10
- Output file structure has changed to use directories
- Parameter name updates:
equation_file
→output_directory
+run_id
- Added clearer naming for parallelism options, such as
parallelism="serial"
rather than the oldmultithreading=False, procs=0
which was unclear
Documentation
The documentation has a new home at https://ai.damtp.cam.ac.uk/pysr/
v0.19.4
What's Changed
- Create
load_all_packages
to install Julia extensions by @MilesCranmer in #688 - Apptainer definition file for PySR by @wkharold in #687
- JuliaCall 0.9.23 by @MilesCranmer in #703
- build(deps): bump juliacall from 0.9.21 to 0.9.22 by @dependabot in #695
New Contributors
Full Changelog: v0.19.3...v0.19.4
v0.19.3
What's Changed
- build(deps): bump juliacall from 0.9.20 to 0.9.21 by @dependabot in #678
Full Changelog: v0.19.2...v0.19.3
v0.19.2
What's Changed
- Avoid automatic upgrade to Julia 1.11 by @MilesCranmer in #671
Full Changelog: v0.19.1...v0.19.2
v0.19.1
What's Changed
- Bump docker/setup-qemu-action from 2 to 3 by @dependabot in #506
- fix:
from pysr import *
by @MilesCranmer in #670
Full Changelog: v0.19.0...v0.19.1
v0.19.0
What's Changed
- BREAKING: Disable automatic sympy simplification by @MilesCranmer in #658
- Build: update numpy version by @MilesCranmer in #650
- Build: bump docker/build-push-action from 5 to 6 by @dependabot in #652
Full Changelog: v0.18.5...v0.19.0
v0.18.5
What's Changed
New features
-
Per-variable custom complexities by @MilesCranmer in #649
model.fit(X, y, complexity_of_variables=[1, 3]) # run a search with feature 1 having complexity 1 and feature 2 with complexity 3
-
Automatically suggest similar parameters by @MilesCranmer in #620
Other
- Bump julia-actions/cache from 1 to 2 by @dependabot in #621
- Update pysr_demo.ipynb by @VishalJ99 in #624
- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #612
- Bump docker/login-action from 2 to 3 by @dependabot in #509
- More extensive typing stubs and associated refactoring by @MilesCranmer in #609
Full Changelog: v0.18.4...v0.18.5
Backend changes
New features
- Allow per-variable complexity (MilesCranmer/SymbolicRegression.jl#324) (@MilesCranmer)
Other
- ci: split up test suite into multiple runners (MilesCranmer/SymbolicRegression.jl#311) (@MilesCranmer)
- chore(deps): bump julia-actions/cache from 1 to 2 (MilesCranmer/SymbolicRegression.jl#315) (https://github.com/dependabot[bot])
- CompatHelper: bump compat for DynamicQuantities to 0.14, (keep existing compat) (MilesCranmer/SymbolicRegression.jl#317) (@github-actions[bot])
- Use DispatchDoctor.jl to wrap entire package with
@stable
(MilesCranmer/SymbolicRegression.jl#321) (@MilesCranmer) - CompatHelper: bump compat for MLJModelInterface to 1, (keep existing compat) (MilesCranmer/SymbolicRegression.jl#322) (@github-actions[bot])
- Mark more functions as stable (MilesCranmer/SymbolicRegression.jl#323) (@MilesCranmer)
- Refactor tests to use TestItems.jl (MilesCranmer/SymbolicRegression.jl#325) (@MilesCranmer)
Full Changelog: MilesCranmer/SymbolicRegression.jl@v0.24.4...v0.24.5
New Contributors
- @VishalJ99 made their first contribution in #624
v0.18.4
Frontend changes
- Add dimensionless constants mode; update Python version constraints; upgrade juliacall to 0.9.20 (#608) (@MilesCranmer)
- Fix sign typo in example docs (#611) (@hvaara)
Full Changelog: v0.18.3...v0.18.4
Backend changes
- Up to 40% speedup for default settings via more parallelism inside workers (MilesCranmer/SymbolicRegression.jl#304) (@MilesCranmer)
- feat: use
?
for wildcard units instead of⋅
(MilesCranmer/SymbolicRegression.jl#307) (@MilesCranmer) - refactor: fix some more type instabilities (MilesCranmer/SymbolicRegression.jl#308) (@MilesCranmer)
- refactor: remove unused Tricks dependency (MilesCranmer/SymbolicRegression.jl#309) (@MilesCranmer)
- Add option to force dimensionless constants (MilesCranmer/SymbolicRegression.jl#310) (@MilesCranmer)
Full Changelog: MilesCranmer/SymbolicRegression.jl@v0.24.2...v0.24.4
New Contributors
v0.18.3
Frontend changes
- Automated update to backend: v0.24.3 by @github-actions in #605
Full Changelog: v0.18.2...v0.18.3
Backend changes
Full Changelog: MilesCranmer/SymbolicRegression.jl@v0.24.1...v0.24.2
v0.18.2
Frontend changes
- Add missing
greater
operator in sympy mapping by @MilesCranmer in #590 - Bump julia-actions/setup-julia from 1 to 2 by @dependabot in #591
- [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #537
- Automated update to backend: v0.24.2 by @MilesCranmer in #598
Full Changelog: v0.18.1...v0.18.2
Backend changes
Merged pull requests:
- Bump julia-actions/setup-julia from 1 to 2 (MilesCranmer/SymbolicRegression.jl#300) (@dependabot[bot])
- [pre-commit.ci] pre-commit autoupdate (MilesCranmer/SymbolicRegression.jl#301) (@pre-commit-ci[bot])
- A small update on examples.md for 1-based indexing (MilesCranmer/SymbolicRegression.jl#302) (@liuyxpp)
- Fixes for Julia 1.11 (MilesCranmer/SymbolicRegression.jl#303) (@MilesCranmer)
Closed issues:
- API Overhaul (MilesCranmer/SymbolicRegression.jl#187)
- [Feature]: Training on high dimensions X (MilesCranmer/SymbolicRegression.jl#299)
Full Changelog: MilesCranmer/SymbolicRegression.jl@v0.24.1...v0.24.2