MilesCranmer commited on
Commit
a32623a
1 Parent(s): 6b966fe

Update `EquationSearch` to `equation_search`

Browse files
Files changed (2) hide show
  1. docs/backend.md +1 -1
  2. pysr/sr.py +2 -2
docs/backend.md CHANGED
@@ -20,7 +20,7 @@ git clone https://github.com/MilesCranmer/SymbolicRegression.jl
20
  - [`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.
21
  - 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.
22
  - [`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.
23
- - 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).
24
  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.
25
  - Note that it will automatically update your project by default; to turn this off, set `update=False`.
26
 
 
20
  - [`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.
21
  - 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.
22
  - [`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.
23
+ - 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).
24
  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.
25
  - Note that it will automatically update your project by default; to turn this off, set `update=False`.
26
 
pysr/sr.py CHANGED
@@ -1702,12 +1702,12 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1702
 
1703
  # Call to Julia backend.
1704
  # See https://github.com/MilesCranmer/SymbolicRegression.jl/blob/master/src/SymbolicRegression.jl
1705
- self.raw_julia_state_ = SymbolicRegression.EquationSearch(
1706
  Main.X,
1707
  Main.y,
1708
  weights=Main.weights,
1709
  niterations=int(self.niterations),
1710
- varMap=self.feature_names_in_.tolist(),
1711
  options=options,
1712
  numprocs=cprocs,
1713
  parallelism=parallelism,
 
1702
 
1703
  # Call to Julia backend.
1704
  # See https://github.com/MilesCranmer/SymbolicRegression.jl/blob/master/src/SymbolicRegression.jl
1705
+ self.raw_julia_state_ = SymbolicRegression.equation_search(
1706
  Main.X,
1707
  Main.y,
1708
  weights=Main.weights,
1709
  niterations=int(self.niterations),
1710
+ variable_names=self.feature_names_in_.tolist(),
1711
  options=options,
1712
  numprocs=cprocs,
1713
  parallelism=parallelism,