-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #353 from MilesCranmer/abstract-options
Create overloadable utilities: `AbstractOptions`, `AbstractRuntimeOptions`, `AbstractMutationWeights`, `AbstractSearchState`, and `mutate!`
- Loading branch information
Showing
41 changed files
with
1,150 additions
and
573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ SRRegressor | |
MultitargetSRRegressor | ||
``` | ||
|
||
## equation_search | ||
## Low-Level API | ||
|
||
```@docs | ||
equation_search | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Customization | ||
|
||
Many parts of SymbolicRegression.jl are designed to be customizable. | ||
|
||
The normal way to do this in Julia is to define a new type that subtypes | ||
an abstract type from a package, and then define new methods for the type, | ||
extending internal methods on that type. | ||
|
||
## Custom Options | ||
|
||
For example, you can define a custom options type: | ||
|
||
```@docs | ||
AbstractOptions | ||
``` | ||
|
||
Any function in SymbolicRegression.jl you can generally define a new method | ||
on your custom options type, to define custom behavior. | ||
|
||
## Custom Mutations | ||
|
||
You can define custom mutation operators by defining a new method on | ||
`mutate!`, as well as subtyping `AbstractMutationWeights`: | ||
|
||
```@docs | ||
mutate! | ||
AbstractMutationWeights | ||
condition_mutation_weights! | ||
sample_mutation | ||
MutationResult | ||
``` | ||
|
||
## Custom Expressions | ||
|
||
You can create your own expression types by defining a new type that extends `AbstractExpression`. | ||
|
||
```@docs | ||
AbstractExpression | ||
ExpressionInterface | ||
``` | ||
|
||
The interface is fairly flexible, and permits you define specific functional forms, | ||
extra parameters, etc. See the documentation of DynamicExpressions.jl for more details on what | ||
methods you need to implement. Then, for SymbolicRegression.jl, you would | ||
pass `expression_type` to the `Options` constructor, as well as any | ||
`expression_options` you need (as a `NamedTuple`). | ||
|
||
If needed, you may need to overload `SymbolicRegression.ExpressionBuilder.extra_init_params` in | ||
case your expression needs additional parameters. See the method for `ParametricExpression` | ||
as an example. | ||
|
||
## Other Customizations | ||
|
||
Other internal abstract types include the following: | ||
|
||
```@docs | ||
AbstractRuntimeOptions | ||
AbstractSearchState | ||
``` | ||
|
||
These let you include custom state variables and runtime options. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.