Skip to content

Commit

Permalink
Update EquationSearch to equation_search
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer authored Jun 20, 2023
1 parent 6b966fe commit a32623a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ git clone https://github.com/MilesCranmer/SymbolicRegression.jl
- [`src/CheckConstraints.jl`](https://github.com/MilesCranmer/SymbolicRegression.jl/blob/master/src/CheckConstraints.jl), particularly the function `check_constraints`. This function checks whether a given expression satisfies constraints, such as having a complexity lower than `maxsize`, and whether it contains any forbidden nestings of functions.
- Note that all expressions, *even intermediate expressions*, must comply with constraints. Therefore, make sure that evolution can still reach your desired expression (with one mutation at a time), before setting a hard constraint. In other cases you might want to instead put in the loss function.
- [`src/Options.jl`](https://github.com/MilesCranmer/SymbolicRegression.jl/blob/master/src/Options.jl), as well as the struct definition in [`src/OptionsStruct.jl`](https://github.com/MilesCranmer/SymbolicRegression.jl/blob/master/src/OptionsStruct.jl). This file specifies all the options used in the search: an instance of `Options` is typically available throughout every function in `SymbolicRegression.jl`. If you add new functionality to the backend, and wish to make it parameterizable (including from PySR), you should specify it in the options.
- For reference, the main loop itself is found in the `EquationSearch` function inside [`src/SymbolicRegression.jl`](https://github.com/MilesCranmer/SymbolicRegression.jl/blob/master/src/SymbolicRegression.jl).
- For reference, the main loop itself is found in the `equation_search` function inside [`src/SymbolicRegression.jl`](https://github.com/MilesCranmer/SymbolicRegression.jl/blob/master/src/SymbolicRegression.jl).
3. Specify the directory of `SymbolicRegression.jl` to PySR by setting `julia_project` in the `PySRRegressor` object, and run `.fit` when you're ready. That's it! No compilation or build steps required.
- Note that it will automatically update your project by default; to turn this off, set `update=False`.

Expand Down
4 changes: 2 additions & 2 deletions pysr/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1702,12 +1702,12 @@ def _run(self, X, y, mutated_params, weights, seed):

# Call to Julia backend.
# See https://github.com/MilesCranmer/SymbolicRegression.jl/blob/master/src/SymbolicRegression.jl
self.raw_julia_state_ = SymbolicRegression.EquationSearch(
self.raw_julia_state_ = SymbolicRegression.equation_search(
Main.X,
Main.y,
weights=Main.weights,
niterations=int(self.niterations),
varMap=self.feature_names_in_.tolist(),
variable_names=self.feature_names_in_.tolist(),
options=options,
numprocs=cprocs,
parallelism=parallelism,
Expand Down

0 comments on commit a32623a

Please sign in to comment.