-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: other algorithms are now functional 🎉
- Loading branch information
Showing
7 changed files
with
49 additions
and
98 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,26 @@ | ||
""" | ||
$(TYPEDEF) | ||
@concrete struct RandomSearch <: AbstractDAGSRAlgorithm | ||
options <: CommonAlgOptions | ||
end | ||
|
||
Performs a random search over the space of possible solutions to the | ||
symbolic regression problem. | ||
""" | ||
$(SIGNATURES) | ||
# Fields | ||
$(FIELDS) | ||
Performs a random search over the space of possible solutions to the symbolic regression | ||
problem. | ||
""" | ||
@kwdef struct RandomSearch{F, A, L, O} <: AbstractDAGSRAlgorithm | ||
# "The number of candidates to track" | ||
# populationsize::Int = 100 | ||
# "The functions to include in the search" | ||
# functions::F = (sin, exp, cos, log, +, -, /, *) | ||
# "The arities of the functions" | ||
# arities::A = (1, 1, 1, 1, 2, 2, 2, 2) | ||
# "The number of layers" | ||
# n_layers::Int = 1 | ||
# "Include skip layers" | ||
# skip::Bool = true | ||
# "Simplex mapping" | ||
# simplex::AbstractSimplex = Softmax() | ||
# "Evaluation function to sort the samples" | ||
# loss::L = aicc | ||
# "The number of candidates to keep in each iteration" | ||
# keep::Union{Real, Int} = 0.1 | ||
# "Use protected operators" | ||
# use_protected::Bool = true | ||
# "Use distributed optimization and resampling" | ||
# distributed::Bool = false | ||
# "Use threaded optimization and resampling - not implemented right now." | ||
# threaded::Bool = false | ||
# "Random seed" | ||
# rng::AbstractRNG = Random.default_rng() | ||
# "Optim optimiser" | ||
# optimizer::O = LBFGS() | ||
# "Optim options" | ||
# optim_options::Optim.Options = Optim.Options() | ||
# "Observed model - if `nothing`is used, a normal distributed additive error with fixed variance is assumed." | ||
# observed::Union{ObservedModel, Nothing} = nothing | ||
# "Field for possible optimiser - no use for Randomsearch" | ||
# optimiser::Nothing = nothing | ||
function RandomSearch(; populationsize = 100, functions = (sin, exp, cos, log, +, -, /, *), | ||
arities = (1, 1, 1, 1, 2, 2, 2, 2), n_layers = 1, skip = true, loss = aicc, | ||
keep = 0.1, use_protected = true, distributed = false, threaded = false, | ||
rng = Random.default_rng(), optimizer = LBFGS(), optim_options = Optim.Options(), | ||
observed = nothing, alpha = 0.999f0) | ||
return RandomSearch(CommonAlgOptions(; | ||
populationsize, functions, arities, n_layers, skip, simplex = Softmax(), loss, | ||
keep, use_protected, distributed, threaded, rng, optimizer, | ||
optim_options, optimiser = nothing, observed, alpha)) | ||
end | ||
|
||
Base.print(io::IO, ::RandomSearch) = print(io, "RandomSearch") | ||
Base.summary(io::IO, x::RandomSearch) = print(io, x) | ||
|
||
# Randomsearch does not do anything | ||
function update_parameters!(::SearchCache) | ||
return | ||
end | ||
update_parameters!(::SearchCache) = nothing |
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