Skip to contents

A KnockoffSampler defaulting to second-order Gaussian knockoffs as created by knockoff::create.second_order.

Details

This is equivalent to KnockoffSampler using the default knockoff_fun.

References

Watson D, Wright M (2021). “Testing conditional independence in supervised learning algorithms.” Machine Learning, 110(8), 2107-2129. doi:10.1007/s10994-021-06030-6 .

Blesch K, Watson D, Wright M (2023). “Conditional feature importance for mixed data.” AStA Advances in Statistical Analysis, 108(2), 259-278. doi:10.1007/s10182-023-00477-9 .

Public fields

feature_types

(character()) Feature types supported by the sampler. Will be checked against the provied mlr3::Task to ensure compatibility.

x_tilde

Knockoff matrix

Methods

Inherited methods


Method new()

Creates a new instance using Gaussian knockoffs via knockoff::create.second_order.

Usage

KnockoffGaussianSampler$new(task, iters = 1)

Arguments

task

(mlr3::Task) Task to sample from.

iters

(integer(1): 1) Number of repetitions the knockoff_fun is applied to create multiple x_tilde instances per observation.


Method clone()

The objects of this class are cloneable with this method.

Usage

KnockoffGaussianSampler$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

library(mlr3)
task = tgen("2dnormals")$generate(n = 100)
# Create sampler
sampler = KnockoffGaussianSampler$new(task)
# Sample using row_ids from stored task
sampled_data = sampler$sample("x1")