Skip to contents

Feature Importance Method Class

Feature Importance Method Class

Public fields

label

(character(1)) Method label.

task

(mlr3::Task)

learner

(mlr3::Learner)

measure

(mlr3::Measure)

resampling

(mlr3::Resampling)

resample_result

(mlr3::ResampleResult)

features

(character)

param_set

(paradox::ps())

scores

(data.table) Individual performance scores used to compute $importance per resampling iteration and permutation iteration.

obs_losses

(data.table) Observation-wise losses when available (e.g., when using obs_loss = TRUE). Contains columns for row_ids, feature, iteration indices, individual loss values, and both reference and feature-specific predictions.

predictions

(data.table) Feature-specific prediction objects when using obs_loss = TRUE. Contains columns for feature, iteration, iter_refit, and prediction objects. Similar to ResampleResult$predictions() but extended for feature-specific models.

Methods


Method new()

Creates a new instance of this R6 class. This is typically intended for use by derived classes.

Usage

FeatureImportanceMethod$new(
  task,
  learner,
  measure,
  resampling = NULL,
  features = NULL,
  param_set = paradox::ps(),
  label
)

Arguments

task, learner, measure, resampling, features, param_set, label

Used to set fields


Method compute()

Compute feature importance scores

Usage

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

Arguments

relation

(character(1): "difference") How to relate perturbed scores to originals ("difference" or "ratio")

store_backends

(logical(1): TRUE) Whether to store backends.


Method importance()

Get aggregated importance scores. The stored measure object's aggregator (default: mean) will be used to aggregated importance scores across resampling iterations and, depending on the method use, permutations (PerturbationImportance or refits LOCO).

Usage

FeatureImportanceMethod$importance(standardize = FALSE)

Arguments

standardize

(logical(1): FALSE) If TRUE, importances are standardized by the highest score so all scores fall in [-1, 1].

Returns

(data.table) Aggregated importance scores.


Method reset()

Resets all stored fields populated by $compute: $resample_result, $scores, $obs_losses, and $predictions.

Usage

FeatureImportanceMethod$reset()


Method print()

Print importance scores

Usage

FeatureImportanceMethod$print(...)

Arguments

...

Passed to print()


Method clone()

The objects of this class are cloneable with this method.

Usage

FeatureImportanceMethod$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.