slickEcr  R Documentation 
Mostly ecr::ecr
, with some simplifications and extensions.
slickEcr
does mostly what ecr::ecr
does, with different default values at places.
Note that fitness.fun
must be a "smoof
" function.
initEcr
only evaluates fitness for the initial population and does not perform any
mutation or selection.
continueEcr
continues a run for another number of generations
. Only ecr.object
(a result from a previous initEcr
, slickEcr
, or continueEcr
call) and
generations
must be given, the other arguments are optional. If they were set
in a previous slickEcr
or continueEcr
call, the values from the
previous run are used. Otherwise it is possible to supply any combination of these values
to set them to new values.
Note, for fidelity
, that the generation continues counting from previous runs,
so if initEcr
was ran for 5 generations and continueEcr
is called with
a fidelity
with first column values c(1, 8)
, then the fidelity given in the
first row is applied for 2 generations, after which the fidelity given in the
second row applies.
slickEcr( fitness.fun, lambda, population, mutator, recombinator, generations = 100, parent.selector = selSimple, survival.selector = selNondom, p.recomb = 0.7, p.mut = 0.3, survival.strategy = "plus", n.elite = 0, fidelity = NULL, unbiased.fidelity = TRUE, log.stats = NULL, log.stats.newinds = c(list(runtime = list("mean", "sum")), if (!is.null(fidelity)) list(fidelity = list("sum"))) ) initEcr( fitness.fun, population, fidelity = NULL, log.stats = NULL, log.stats.newinds = c(list(runtime = list("mean", "sum")), if (!is.null(fidelity)) list(fidelity = list("sum"))), unbiased.fidelity = TRUE ) continueEcr( ecr.object, generations, lambda = NULL, mutator = NULL, recombinator = NULL, parent.selector = NULL, survival.selector = NULL, p.recomb = NULL, p.mut = NULL, survival.strategy = NULL, n.elite = NULL, fidelity = NULL, unbiased.fidelity = NULL )
fitness.fun 

lambda 

population 

mutator 

recombinator 

generations 

parent.selector 

survival.selector 

p.recomb 

p.mut 

survival.strategy 

n.elite 

fidelity 

unbiased.fidelity 

log.stats 

log.stats.newinds 

ecr.object 

[MosmafsResult]
the terminated optimization state.
library("mlr") library("magrittr") library("mlrCPO") # Define tasks task.whole < create.hypersphere.data(3, 2000) %>% create.classif.task(id = "sphere") %>% task.add.permuted.cols(10) rows.whole < sample(2000) task < subsetTask(task.whole, rows.whole[1:500]) task.hout < subsetTask(task.whole, rows.whole[501:2000]) # Create learner lrn < makeLearner("classif.rpart", maxsurrogate = 0) # Create parameter set to optimize over ps < pSS( maxdepth: integer[1, 30], minsplit: integer[2, 30], cp: numeric[0.001, 0.999]) # Create fitness function fitness.fun < makeObjective(lrn, task, ps, cv5, holdout.data = task.hout) # Receive parameter set from fitness function ps.objective < getParamSet(fitness.fun) # Define mutators and recombinators mutator < combine.operators(ps.objective, numeric = ecr::setup(mutGauss, sdev = 0.1), integer = ecr::setup(mutGaussInt, sdev = 3), selector.selection = mutBitflipCHW) crossover < combine.operators(ps.objective, numeric = recPCrossover, integer = recPCrossover, selector.selection = recPCrossover) # Initialize population and evaluate it initials < sampleValues(ps.objective, 32, discrete.names = TRUE) run.init < initEcr(fitness.fun = fitness.fun, population = initials) # Run NSGAII for 5 generations with run.init as input run.gen < continueEcr(run.init, generations = 5, lambda = 5, mutator = mutator, recombinator = crossover, parent.selector = selSimple, survival.selector = selNondom, p.recomb = 0.7, p.mut = 0.3, survival.strategy = "plus") # Or instead of initEcr and continueEcr use the shortcut function slickEcr run.simple < slickEcr( fitness.fun = fitness.fun, lambda = 5, population = initials, mutator = mutator, recombinator = crossover, generations = 5) print(run.simple)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.