feature_combinations {shapr} | R Documentation |
Define feature combinations, and fetch additional information about each unique combination
Description
Define feature combinations, and fetch additional information about each unique combination
Usage
feature_combinations(
m,
exact = TRUE,
n_combinations = 200,
weight_zero_m = 10^6
)
Arguments
m |
Positive integer. Total number of features. |
exact |
Logical. If |
n_combinations |
Positive integer. Note that if |
weight_zero_m |
Numeric. The value to use as a replacement for infinite combination weights when doing numerical operations. |
Value
A data.table that contains the following columns:
- id_combination
Positive integer. Represents a unique key for each combination. Note that the table is sorted by
id_combination
, so that is always equal tox[["id_combination"]] = 1:nrow(x)
.- features
List. Each item of the list is an integer vector where
features[[i]]
represents the indices of the features included in combinationi
. Note that all the items are sorted such thatfeatures[[i]] == sort(features[[i]])
is always true.- n_features
Vector of positive integers.
n_features[i]
equals the number of features in combinationi
, i.e.n_features[i] = length(features[[i]])
.
.
- N
Positive integer. The number of unique ways to sample
n_features[i]
features fromm
different features, without replacement.
Author(s)
Nikolai Sellereite, Martin Jullum
Examples
# All combinations
x <- feature_combinations(m = 3)
nrow(x) # Equals 2^3 = 8
# Subsample of combinations
x <- feature_combinations(exact = FALSE, m = 10, n_combinations = 1e2)