| MarginalSampler | R Documentation |
Abstract base class for marginal sampling strategies that do not condition on other features. Marginal samplers sample from P(X_S), the marginal distribution of features S, ignoring any dependencies with other features.
This class provides a common interface for different marginal sampling approaches:
MarginalPermutationSampler: Shuffles features independently within the dataset
MarginalReferenceSampler: Samples complete rows from reference data
Both approaches sample from the marginal distribution P(X_S), but differ in how they preserve or break within-row dependencies:
Permutation breaks ALL dependencies (both with target and between features)
Reference sampling preserves WITHIN-row dependencies but breaks dependencies with test data
Comparison with ConditionalSampler:
MarginalSampler: Samples from P(X_S) - no conditioning
ConditionalSampler: Samples from P(X_S | X_{-S})- conditions on other features
This base class implements the public $sample() and $sample_newdata() methods,
delegating to private .sample_marginal() which subclasses must implement.
xplainfi::FeatureSampler -> MarginalSampler
sample()Sample features from their marginal distribution.
MarginalSampler$sample(feature, row_ids = NULL)
feature(character()) Feature name(s) to sample.
row_ids(integer() | NULL) Row IDs from task to use.
Modified copy with sampled feature(s).
sample_newdata()Sample from external data.
MarginalSampler$sample_newdata(feature, newdata)
feature(character()) Feature(s) to sample.
newdata(data.table) External data to use.
Modified copy with sampled feature(s).
clone()The objects of this class are cloneable with this method.
MarginalSampler$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.