dict_mutators_unif: Uniform Discrete Mutator

dict_mutators_unifR Documentation

Uniform Discrete Mutator

Description

Discrete components are mutated by sampling from a uniform distribution, either from all possible values of each component, or from all values except the original value.

Since the information loss is very high, this should in most cases be combined with MutatorCmpMaybe.

Configuration Parameters

  • can_mutate_to_same :: logical(1)
    Whether to sample from entire range of each parameter (TRUE) or from all values except the current value (FALSE). Initialized to TRUE.

Supported Operand Types

Supported Domain classes are: p_lgl ('ParamLgl'), p_fct ('ParamFct')

Dictionary

This Mutator can be created with the short access form mut() (muts() to get a list), or through the the dictionary dict_mutators in the following way:

# preferred:
mut("unif")
muts("unif")  # takes vector IDs, returns list of Mutators

# long form:
dict_mutators$get("unif")

Super classes

miesmuschel::MiesOperator -> miesmuschel::Mutator -> miesmuschel::MutatorDiscrete -> MutatorDiscreteUniform

Methods

Public methods

Inherited methods

Method new()

Initialize the MutatorDiscreteUniform object.

Usage
MutatorDiscreteUniform$new()

Method clone()

The objects of this class are cloneable with this method.

Usage
MutatorDiscreteUniform$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other mutators: Mutator, MutatorDiscrete, MutatorNumeric, OperatorCombination, dict_mutators_cmpmaybe, dict_mutators_erase, dict_mutators_gauss, dict_mutators_maybe, dict_mutators_null, dict_mutators_proxy, dict_mutators_sequential

Examples

set.seed(1)
mdu = mut("unif")
p = ps(x = p_lgl(), y = p_fct(c("a", "b", "c")))
data = data.frame(x = rep(TRUE, 5), y = rep("a", 5),
  stringsAsFactors = FALSE)  # necessary for R <= 3.6

mdu$prime(p)
mdu$operate(data)

mdu$param_set$values$can_mutate_to_same = FALSE
mdu$operate(data)

miesmuschel documentation built on June 22, 2024, 9:39 a.m.