Group Structure
GroupStructure.Rd
Class to represent a group structure.
Public fields
feature_names
(character())
The names of the features of the mlr3::Task.
Active bindings
n_features
(integer(1))
Number of features part of the mlr3::Task.n_selected
(integer(1))
Number of selected features based on the group structure.selected_features
(character())
Names of the selected features.unselected_features
(character())
Names of the unselected features.n_groups
(integer(1))
Number of groups under the group structure. Determined based on the number of equivalence classes + 1 (due to the first group of unselected features also always being accounted for).monotone_features
(data.table::data.table)
A data.table with as many rows as features with the feature column indicating the feature and the monotonicity column indicating the monotonicity constraint as an integer (NA
indicating no constraint, e.g., for unselected features).groups
(list())
A list containing a character vector of all features ($features
), an integer vector of all equivalence classes ($eqcs
) and an integer vector indicating the belonging of each feature to each class ($belonging)
.monotone_eqcs
(data.table::data.table)
A data.table with as many rows as equivalence classes with the eqcs column indicating the equivalence class and the monotonicity column indicating the monotonicity constraint as an integer (NA
indicating no constraint, e.g., for the group of unselected features).allow_all_unselected
(logical(1))
Whether unselecting all features should be allowed i.e., having only a single group of unselected features is considered a valid group structure.
Methods
Method new()
Creates a new instance of this R6 class.
Usage
GroupStructure$new(
task,
n_selected = NULL,
scores = NULL,
interaction_detector = NULL,
unconstrained_weight_table = NULL,
unconstrained = FALSE
)
Arguments
task
([mlr3::Task)
Task.n_selected
(integer(1))
Number of selected features.scores
(data.table::data.table)
data.table with as many rows as features and two columnsfeature
andscore
withfeature
being the id of the feature andscore
being the feature importance score.interaction_detector
(InteractionDetector)
Interaction detector.unconstrained_weight_table
(data.table::data.table)
data.table with as many rows as features and two columnsfeature_name
andunconstrained_weight
withfeature_name
being the id of the feature andunconstrained_weight
being the score based on an MonotonicityDetector.unconstrained
(logical(1))
Whether an unconstrained group structure should be created. This means that all features are selected and all features are allowed to interact and no features are constrained with respect to a monotone feature effect.
Method create_interaction_constraints()
Method to create a list of interaction constraints of features.
Method create_monotonicity_constraints()
Method to create an integer vector of monotonicity constraints of selected features.
Method get_full_group_structure()
Method to create the full group structure based on the equivalence classes of features allowed to interact and the unselected features forming the first group.
Arguments
eqcs
(list())
List containing a (character()) vector of selected features, an (integer()) vector of equivalence classes ids and an (integer()) vector indicating the equivalence class each feature belongs to.unselected_features
(character())
Character vector describing the set on unselected features
Method mutate()
Performs mutations on the group structure by creating a new group, destroying a group, shuffling membership, or mutating group membership.
Method crossover()
Performs crossover between the groups of two GroupStructure objects. First parent is given by groups of the object itself (self$groups). Combines and exchanges groups between the parent objects based on the specified crossing sections.
Arguments
parent2
(list(1))
A group of a GroupStructure object representing the second parent.crossing_sections
(list(1))
A list containing the crossing sections for the first parent (crossing_section1
) and second parent (crossing_section2
). The crossing sections define the boundaries of groups to be exchanged between the parents. Each crossing section is an integer vector of length 2, indicating the start and end points of the crossing section.
Method get_crossing_sections()
Calculates and returns the crossing sections for performing crossover between the group structures of two groups of GroupStructure objects. The crossing sections define the boundaries of groups to be exchanged between the parents during crossover.