dict_selectors_sequential: Run Multiple Selection Operations in Sequence

dict_selectors_sequentialR Documentation

Run Multiple Selection Operations in Sequence

Description

Selector that wraps multiple other Selectors given during construction and uses them for selection in sequence. This makes it possible for one Selector to discard a few individuals, followed by a second Selector to discard more, etc., until n_select individuals are remaining.

Algorithm

Given that there are nrow(values) input individuals in an operation, and n_select individuals requested to be selected, the operation calls selector_i for i in 1 ... length(selectors) to reduce the number of individuals in this pipeline. The relative quantity by which the number of individuals is reduced in each step is determined by the configuration parameters reduction_1, reduction_2, etc., and also dependent on the sum of these values, in the following denoted, with a slight abuse of notation, by ⁠sum[reduction_#]⁠.

Let the number of individuals passed to step i be denoted by n_values[i], and the number of individuals requested to be selected by that step be denoted as n_select_[i]. In particular, n_values[1] == nrow(values), and n_select_[length(selectors)] == n_select.

When reduction_by_factor is TRUE, then the reduction at step i is done by a factor, meaning that n_values[i] / n_select_[i] is set (up to rounding). This factor is ⁠(nrow(values) / n_select) ^ (reduction_i / sum[reduction_#])⁠.

When reduction_by_factor is FALSE, then the reduction at step i is done by absolute differences, meaning that n_values[i] - n_select_[i] is set (up to rounding). This difference is ⁠(nrow(values) - n_select) * (reduction_i / sum[reduction_#])⁠, with ⁠sum[reduction_#]⁠ as above.

In particular, this means that when all reduction_# values are the same and reduction_by_factor is TRUE, then each operation reduces the number of individuals in the pipeline by the same factor. When reduction_by_factor is FALSE, then each operation removes the same absolute number of individuals.

While the illustrations are done with the assumption that nrow(values) >= n_select, they hold equivalently with nrow(values) < n_select.

All except the last Selectors are called with group_size set to their n_select value; the last Selector is called with the group_size value given as input.

Configuration Parameters

This operator has the configuration parameters of the Selectors that it wraps: The configuration parameters of the operator given to the selectors construction argument are prefixed with "selector_1", "selector_2", ... up to "selector_#", where ⁠#⁠ is length(selectors).

Additional configuration parameters:

  • reduction_1, reduction_2, ... :: numeric(1)
    Relative reduction done by selector_1, selector_2, ..., as described in the section Algorithm. The values are all initialized to 1, meaning the same factor (when reduction_by_factor is TRUE) or absolute number (otherwise) of reduction by each operation.

  • reduction_by_factor :: logical(1)
    Whether to do reduction by factor (TRUE) or absolute number (FALSE), as described in Algorithm. Initialized to TRUE.

Supported Operand Types

Supported Domain classes are the set intersection of supported classes of the Selectors given in selectors.

Dictionary

This Selector can be created with the short access form sel() (sels() to get a list), or through the the dictionary dict_selectors in the following way:

# preferred:
sel("sequential", <selectors>)
sels("sequential", <selectors>)  # takes vector IDs, returns list of Selectors

# long form:
dict_selectors$get("sequential", <selectors>)

Super classes

miesmuschel::MiesOperator -> miesmuschel::Selector -> SelectorSequential

Active bindings

selectors

(list of Selector)
Selectors being wrapped. These operators get run sequentially in order.

Methods

Public methods

Inherited methods

Method new()

Initialize the SelectorSequential object.

Usage
SelectorSequential$new(selectors)
Arguments
selectors

(list of Selector)
Selectors to wrap. The operations are run in order given to selectors. The constructed object gets a clone of this argument. The ⁠$selectors⁠ field will reflect this value.


Method prime()

See MiesOperator method. Primes both this operator, as well as the wrapped operators given to selectors during construction.

Usage
SelectorSequential$prime(param_set)
Arguments
param_set

(ParamSet)
Passed to MiesOperator⁠$prime()⁠.

Returns

invisible self.


Method clone()

The objects of this class are cloneable with this method.

Usage
SelectorSequential$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other selectors: Selector, SelectorScalar, dict_selectors_best, dict_selectors_maybe, dict_selectors_null, dict_selectors_proxy, dict_selectors_random, dict_selectors_tournament

Other selector wrappers: dict_selectors_maybe, dict_selectors_proxy


miesmuschel documentation built on Sept. 11, 2024, 8:23 p.m.