| dict_mutators_cmpmaybe {miesmuschel} | R Documentation |
Mutator Choosing Action Component-Wise Independently
Description
Mutator that chooses which operation to perform probabilistically. The Mutator wraps two other Mutators given during construction,
and both of these operators are run. The ultimate result is sampled from the results of these operations independently for each
individuum and component: with probability p (configuration parameter), the result from the Mutator given to the mutator
construction argument is used, and with probability p - 1 the one given to mutator_not is used.
Configuration Parameters
This operator has the configuration parameters of the Mutators that it wraps: The configuration parameters of the operator given to the mutator construction argument
are prefixed with "cmpmaybe.", the configuration parameters of the operator given to the mutator_not construction argument are prefixed with "cmpmaybe_not.".
Additional configuration parameters:
-
p::numeric(1)
Probability per component with which to apply the operator given to themutatorconstruction argument. Must be set by the user.
Supported Operand Types
Supported Domain classes are the set intersection of supported classes of mutator and mutator_not.
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("cmpmaybe", <mutator> [, <mutator_not>])
muts("cmpmaybe", <mutator> [, <mutator_not>]) # takes vector IDs, returns list of Mutators
# long form:
dict_mutators$get("cmpmaybe", <mutator> [, <mutator_not>])
Super classes
miesmuschel::MiesOperator -> miesmuschel::Mutator -> MutatorCmpMaybe
Active bindings
Methods
Public methods
Inherited methods
Method new()
Initialize the MutatorCmpMaybe object.
Usage
MutatorCmpMaybe$new(mutator, mutator_not = MutatorNull$new())
Arguments
mutator(
Mutator)
Mutatorto wrap. Component-wise results of this operator are used with probabilityp(Configuration parameter).
The constructed object gets a clone of this argument. The$mutatorfield will reflect this value.mutator_not(
Mutator)
AnotherMutatorto wrap. Results from this operator are used whenmutatoris not chosen. By default, this isMutatorNull, i.e. no operation.
With this default, theMutatorCmpMaybeobject applies themutatoroperation with probabilityp, and no operation at all otherwise.
The constructed object gets a clone of this argument. The$mutator_notfield will reflect this value.
Method prime()
See MiesOperator method. Primes both this operator, as well as the wrapped operators
given to mutator and mutator_not during construction.
Usage
MutatorCmpMaybe$prime(param_set)
Arguments
param_set(
ParamSet)
Passed toMiesOperator$prime().
Returns
invisible self.
Method clone()
The objects of this class are cloneable with this method.
Usage
MutatorCmpMaybe$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
See Also
Other mutators:
Mutator,
MutatorDiscrete,
MutatorNumeric,
OperatorCombination,
dict_mutators_erase,
dict_mutators_gauss,
dict_mutators_maybe,
dict_mutators_null,
dict_mutators_proxy,
dict_mutators_sequential,
dict_mutators_unif
Other mutator wrappers:
OperatorCombination,
dict_mutators_maybe,
dict_mutators_proxy,
dict_mutators_sequential
Examples
set.seed(1)
mcm = mut("cmpmaybe", mut("gauss", sdev = 5), p = 0.5)
p = ps(x = p_int(-5, 5), y = p_dbl(-5, 5))
data = data.frame(x = rep(0, 5), y = rep(0, 5))
mcm$prime(p)
mcm$operate(data)
mcm$param_set$values$p = 0.2
mcm$operate(data)
mcm2 = mut("cmpmaybe",
mutator = mut("gauss", sdev = 0.01),
mutator_not = mut("gauss", sdev = 10),
p = 0.5
)
mcm2$prime(p)
mcm2$operate(data)