Candidate Utilities

NaiveGAflux.CandidateOptModelType
CandidateOptModel <: AbstractCandidate
CandidateOptModel(optimiser, candidate; checkimplicit=true)

A candidate adding an optimiser to another candidate. The optimiser is accessed by [opt(c)] for CandidateOptModel c.

Usecheckimplicit=false` to avoid consistenty checks for implicit optimiser state (e.g. NaiveNASflux.AutoOptimiser).

source
NaiveGAflux.CandidateDataIterMapType
CandidateDataIterMap{T<:AbstractIteratorMap, C<:AbstractCandidate}     
CandidateDataIterMap(itermap::AbstractIteratorMap, c::AbstractCandidate)

Maps training and validation data iterators using iteratormap for the wrapped candidate c.

Useful for searching for hyperparameters related to training and validation data, such as augmentation and batch size.

While one generally don't want to augment the validation data, it is useful to select the largest possible batch size for validation for speed reasons.

source
NaiveGAflux.FittedCandidateType
FittedCandidate{F, C} <: AbstractWrappingCandidate
FittedCandidate(c::AbstractCandidate, fitnessvalue, generation)
FittedCandidate(c::AbstractCandidate, fitnessfun::AbstractFitness, generation)

An AbstractCandidate with a computed fitness value. Will compute the fitness value if provided an AbstractFitness.

Basically a container for results so that fitness does not need to be recomputed to e.g. check stopping conditions.

Also useful for fitness smoothing, e.g. with EwmaFitness as it gives access to previous fitness value.

source
NaiveGAflux.FileCandidateType
FileCandidate <: AbstractWrappingCandidate
FileCandidate(c::AbstractCandidate)

Keeps c on disk when not in use and just maintains its DRef.

Experimental feature. May not work as intended!

source
NaiveGAflux.MapCandidateType
MapCandidate{T, F} 
MapCandidate(mutations, mapothers::F)

Return a callable struct which maps AbstractCandidates to new AbstractCandidates through mutations which is a tuple of AbstractMutations or AbstractCrossovers.

Basic purpose is to combine multiple mutations operating on different types into a single mapping function which creates new candidates from existing candidates.

When called as a function with an AbstractCandidate c as input, it will map fields f in c (recursively through any wrapped candidates of c) satisfying typeof(f) <: MT through m(f) where m <: AbstractMutation{MT} in mutations.

All other fields are mapped through the function mapothers (default deepcopy).

For instance, if e = MapCandidate(m1, m2) where m1 isa AbstractMutation{CompGraph} and m2 isa AbstractMutation{Optimisers.AbstractRule} then e(c) where c is a CandidateOptModel will create a new CandidateOptModelwhere the new model is m1(model(c)) and the new optimiser is m2(opt(c))

When called as a function with a tuple of two AbstractCandidates as input it will similarly apply crossover between the two candidates, returning two new candidates.

Note that all mutations must be either AbstractMutations or AbstractCrossovers as the resulting function either works on a single candidate or a pair of candidates.

Furthermore, all mutations must operate on different types, i.e there must not be two AbstractMutation{T} (or AbstractCrossover{T}) for any type T.

Intended use is together with EvolveCandidates.

source
NaiveGAflux.PopulationType
struct Population{N, P}
Population(gen, members)
Population(members)

Basic population type which just adds generation counting to its members.

Evolving the population returns a new Population with the generation counter incremented.

source
NaiveGAflux.modelFunction
model(c::AbstractCandidate; [default])

Return the model of candidate c if c has a model, default (which defaults to nothing) otherwise.

source
model(f, c::AbstractCandidate; [default])

Return the result of f([model(c; default)]).

source
NaiveGAflux.optFunction
opt(c::AbstractCandidate; [default])

Return the optimiser of candidate c if c has an optimiser, default (which defaults to nothing) otherwise.

source
NaiveGAflux.lossfunFunction
lossfun(c::AbstractCandidate; [default])

Return the loss function of candidate c if c has a lossfunction, default (which defaults to nothing) otherwise.

source