Skip to content

Releases: MilesCranmer/PySR

v1.3.0

15 Dec 04:58
5c0f26a
Compare
Choose a tag to compare

What's Changed

  • Expanded support for differential operators via backend 1.5.0 by @MilesCranmer in #782

e.g., say we wish to integrate $\frac{1}{x^2 \sqrt{x^2 - 1}}$ for $x > 1$:

import numpy as np
from pysr import PySRRegressor, TemplateExpressionSpec

x = np.random.uniform(1, 10, (1000,))  # Integrand sampling points
y = 1 / (x**2 * np.sqrt(x**2 - 1))     # Evaluation of the integrand

expression_spec = TemplateExpressionSpec(
    ["f"], "((; f), (x,)) -> D(f, 1)(x)"
)

model = PySRRegressor(
    binary_operators=["+", "-", "*", "/"],
    unary_operators=["sqrt"],
    expression_spec=expression_spec,
    maxsize=20,
)
model.fit(x[:, np.newaxis], y)

which should correctly find $\frac{\sqrt{x^2 - 1}}{x}$.

Full Changelog: v1.2.0...v1.3.0

v1.2.0

14 Dec 06:04
dd2d0e2
Compare
Choose a tag to compare

What's Changed

  • Compatibility with new scikit-learn API and test suite by @MilesCranmer in #776
  • Add differential operators and input stream specification by @MilesCranmer in #780
    • (Note: the differential operators aren't yet in a stable state, and are not yet documented. However, they do work!)
    • This PR also adds various GC allocation improvements in the backend.

Frontend Changelog: v1.1.0...v1.2.0

Backend Changelog: MilesCranmer/SymbolicRegression.jl@v1.2.0...v1.4.0

v1.1.0

09 Dec 00:45
89b5a89
Compare
Choose a tag to compare

What's Changed

  • Automated update to backend: v1.2.0 by @github-actions in #770

Full Changelog: v1.0.2...v1.1.0

v1.0.2

07 Dec 00:42
3433e5d
Compare
Choose a tag to compare

What's Changed

  • logger fixes: close streams and persist during warm start by @BrotherHa in #763
  • Let sympy use log2(x) instead of log(x)/log(2) by @nerai in #712

New Contributors

Full Changelog: v1.0.1...v1.0.2

v1.0.1

06 Dec 18:59
2b00ada
Compare
Choose a tag to compare

What's Changed

  • Automated update to backend: v1.1.0 by @github-actions in #762
  • Fall back to eager registry when needed by @DilumAluthge in #765

New Contributors

Full Changelog: v1.0.0...v1.0.1

v1.0.0

01 Dec 00:07
66ea60c
Compare
Choose a tag to compare

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_fileoutput_directory + run_id
    • Added clearer naming for parallelism options, such as parallelism="serial" rather than the old multithreading=False, procs=0 which was unclear

Documentation

The documentation has a new home at https://ai.damtp.cam.ac.uk/pysr/

v0.19.4

23 Aug 03:07
339cc0a
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.19.3...v0.19.4

v0.19.3

29 Jul 02:37
3aee19e
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.19.2...v0.19.3

v0.19.2

15 Jul 22:45
6db7edc
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.19.1...v0.19.2

v0.19.1

15 Jul 14:41
ca00a36
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.19.0...v0.19.1