PySR Versions Save

High-Performance Symbolic Regression in Python and Julia

v0.18.2

1 week ago

Frontend changes

Full Changelog: https://github.com/MilesCranmer/PySR/compare/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: https://github.com/MilesCranmer/SymbolicRegression.jl/compare/v0.24.1...v0.24.2

v0.18.1

4 weeks ago

What's Changed

Full Changelog: https://github.com/MilesCranmer/PySR/compare/v0.18.0...v0.18.1

v0.18.0

1 month ago

Frontend changes

Backend changes

Filtered to only include relevant ones for Python frontend. Also note that not all backend features, like graph-based expressions/program synthesis, are supported yet, so I don't mention those changes yet.

  • (BREAKING) The swap_operands mutation contributed by @foxtran now has a default weight of 0.1 rather than 0.0.

  • (BREAKING) The Dataset struct has had many of its field declared immutable, as a safety precaution.

    • If you had relied on the mutability of the struct to set parameters after initializing it, or had changed any properties of the dataset within a loss function (which actually would break assumptions outside the loss function anyways), you will need to modify your code. Note you can always copy fields of the dataset to variables and then modify those variables
  • LoopVectorization.jl has been moved to a package extension. PySR will install automatically at first use of turbo=True rather than by default, which means faster install time and startup time.

    • Note that LoopVectorization will no longer result in improved performance in Julia 1.11 and thus turbo=True will have no effect on that version (due to internal changes in Julia), which is why I have instead done the following:
  • Bumper.jl support added. Passing bumper=true to PySRRegressor() will result in faster performance.

    • Uses bump allocation (see rust package bumpalo for a good explanation) in the expression evaluation which can get speeds equivalent to LoopVectorization and sometimes even better due to better management of allocations rather than relying on garbage collection. Seems like a pretty good alternative, and doesn't rely on manipulating Julia internals for performance (https://github.com/MilesCranmer/SymbolicRegression.jl/pull/287)
  • Various fixes to distributed compute; confirmed Slurm support again!

  • Now prefer to use new keyword-based constructors for nodes:

    Node{T}(feature=...)        # leaf referencing a particular feature column
    Node{T}(val=...)            # constant value leaf
    Node{T}(op=1, l=x1)         # operator unary node, using the 1st unary operator
    Node{T}(op=1, l=x1, r=1.5)  # binary unary node, using the 1st binary operator
    

    rather than the previous constructors Node(op, l, r) and Node(T; val=...) (though those will still work; just with a depwarn). If you did any construction of nodes manually, note the new syntax. (Old syntax will still work though)

  • Formatting overhaul of backend (https://github.com/MilesCranmer/SymbolicRegression.jl/pull/278)

  • Upgraded Optim to 1.9

  • Upgraded DynamicQuantities to 0.13

  • Upgraded DynamicExpressions to 0.16

  • The main search loop in the backend has been greatly refactored for readability and improved type inference. It now looks like this (down from a monolithic ~1000 line function)

    function _equation_search(
        datasets::Vector{D}, ropt::RuntimeOptions, options::Options, saved_state
    ) where {D<:Dataset}
        _validate_options(datasets, ropt, options)
        state = _create_workers(datasets, ropt, options)
        _initialize_search!(state, datasets, ropt, options, saved_state)
        _warmup_search!(state, datasets, ropt, options)
        _main_search_loop!(state, datasets, ropt, options)
        _tear_down!(state, ropt, options)
        return _format_output(state, ropt)
    end
    

Backend changes: https://github.com/MilesCranmer/SymbolicRegression.jl/compare/v0.23.1...v0.24.1

New Contributors

Full Changelog: https://github.com/MilesCranmer/PySR/compare/v0.17.4...v0.18.0

v0.17.4

1 month ago

Small patch to Julia version to avoid buggy libgomp in 1.10.1 and 1.10.2.

Full Changelog: https://github.com/MilesCranmer/PySR/compare/v0.17.3...v0.17.4

v0.17.3

1 month ago

What's Changed

New Contributors

Full Changelog: https://github.com/MilesCranmer/PySR/compare/v0.17.2...v0.17.3

v0.17.2

1 month ago

What's Changed

New Contributors

Full Changelog: https://github.com/MilesCranmer/PySR/compare/v0.17.1...v0.17.2

v0.17.1

2 months ago

v0.17.0

2 months ago

What's Changed

Detailed changes from #535

  • (BREAKING) Changed PyJulia with JuliaCall
    • Need to change eval -> seval
    • Manually converting to Vector when calling SymbolicRegression.jl functions (otherwise would get passed as PyList{Any}; see https://github.com/JuliaPy/PythonCall.jl/issues/441)
    • Wrapped equation_search code with jl.PythonCall.GC.disable() to avoid multithreading-related segfaults (https://github.com/JuliaPy/PythonCall.jl/issues/298)
    • Manually convert np.str_ to str before passing to variable_names, otherwise it becomes a PyArray and not a String (might be worth adding a workaround, it seems like PyJulia does this automatically)
  • (BREAKING) Julia is now installed automatically when you import pysr (via JuliaCall)
  • (BREAKING) The user no longer needs to run python -m pysr install. The install process is done by JuliaCall at import time.
    • Removed code related to pysr.install() and python -m pysr install because JuliaCall now handles this.
    • python -m pysr install will not give a warning and do nothing.
  • (BREAKING) Remove the feynman problems dataset. Didn't seem good to have a dataset within a library itself.
  • (BREAKING) Deprecated julia_project argument (ignored; no effect). The user now needs to set this up by customizing juliapkg.json. See updated documentation for instructions.
  • (BREAKING) Switch from python -m pysr.test [test] to python -m pysr test [test].
  • Switches to pyproject.toml for building rather than setup.py. However, setup.py install should still work.
  • Dependencies are now managed by pyjuliapkg rather than the custom code we made. Simplifies things a lot!
  • Rather than storing the raw julia variables in PySRRegressor, I am now storing a serialized version of them. This means you can now pickle the search state and warm-start the search from a file, in another Python process!
    • Not breaking! Because self.raw_julia_state_ will deserialize it automatically for you
  • SymbolicRegression is now available to import from PySR:
from pysr import SymbolicRegression as SR
x1 = SR.Node(feature=1)  # Create expressions manually
  • SymbolicRegression options are accessible in <model>.julia_options_ (generated from a serialized format for pickle safety) so that the user can call a variety of functions in SymbolicRegression.jl directly.
  • Deprecated various kwargs to match SymbolicRegression.jl (old names will still work, so this is not breaking):
    • ncyclesperiteration => ncycles_per_iteration
    • loss => elementwise_loss
    • full_objective => loss_function
  • Fixes Jupyter printing by automatically loading the juliacall.ipython extension at import time
  • Adds Zygote.jl to environment by default
  • Does unittesting on an example Jupyter notebook

Full Changelog: https://github.com/MilesCranmer/PySR/compare/v0.16.9...v0.17.0

v0.16.9

3 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/MilesCranmer/PySR/compare/v0.16.8...v0.16.9

v0.16.8

3 months ago

What's Changed

Full Changelog: https://github.com/MilesCranmer/PySR/compare/v0.16.7...v0.16.8