Skip to contents

Base class for Leave-Out and Leave-In feature importance methods. This is an abstract class - use LOCO or LOCI.

Super class

xplainfi::FeatureImportanceMethod -> LeaveOutIn

Public fields

direction

(character(1)) Either "leave-out" or "leave-in".

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage

LeaveOutIn$new(
  task,
  learner,
  measure,
  resampling = NULL,
  features = NULL,
  direction,
  label,
  iters_refit = 1L,
  obs_loss = FALSE,
  aggregation_fun = median
)

Arguments

task, learner, measure, resampling, features

Passed to FeatureImportanceMethod for construction.

direction

(character(1)) Either "leave-out" or "leave-in".

label

(character(1)) Method label.

iters_refit

(integer(1)) Number of refit iterations per resampling iteration.

obs_loss

(logical(1)) Whether to use observation-wise loss calculation (original LOCO formulation) when supported by the measure. If FALSE (default), uses aggregated scores.

aggregation_fun

(function) Function to aggregate observation-wise losses when obs_loss = TRUE. Defaults to median for original LOCO formulation.


Method compute()

Computes leave-out or leave-in feature importance.

Usage

LeaveOutIn$compute(relation = c("difference", "ratio"), store_backends = TRUE)

Arguments

relation

(character(1)) Calculate "difference" (default) or "ratio" of original scores and scores after leaving out/in features.

store_backends

(logical(1)) Passed to mlr3::resample to store backends in resample result. Required for some measures, but may increase memory footprint.


Method clone()

The objects of this class are cloneable with this method.

Usage

LeaveOutIn$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.