| LOCO | R Documentation |
Calculates Leave-One-Covariate-Out (LOCO) scores.
LOCO measures feature importance by comparing model performance with and without each feature. For each feature, the model is retrained without that feature and the performance difference (reduced_model_loss - full_model_loss) indicates the feature's importance. Higher values indicate more important features.
xplainfi::FeatureImportanceMethod -> xplainfi::WVIM -> LOCO
new()Creates a new instance of this R6 class.
LOCO$new( task, learner, measure = NULL, resampling = NULL, features = NULL, n_repeats = 30L )
task(mlr3::Task) Task to compute importance for.
learner(mlr3::Learner) Learner to use for prediction.
measure(mlr3::Measure: NULL) Measure to use for scoring. Defaults to
classif.ce for classification and regr.mse for regression.
resampling(mlr3::Resampling) Resampling strategy. Defaults to holdout.
features(character()) Features to compute importance for. Defaults to all features.
n_repeats(integer(1): 30L) Number of refit iterations per resampling iteration.
compute()Compute LOCO importances.
LOCO$compute(store_models = TRUE, store_backends = TRUE)
store_models, store_backends(logical(1): TRUE) Whether to store fitted models / data backends, passed to mlr3::resample internally
clone()The objects of this class are cloneable with this method.
LOCO$clone(deep = FALSE)
deepWhether to make a deep clone.
Lei J, G'Sell M, Rinaldo A, Tibshirani R, Wasserman L (2018). “Distribution-Free Predictive Inference for Regression.” Journal of the American Statistical Association, 113(523), 1094–1111. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/01621459.2017.1307116")}.
library(mlr3)
library(mlr3learners)
task <- sim_dgp_correlated(n = 500)
loco <- LOCO$new(
task = task,
learner = lrn("regr.rpart"),
measure = msr("regr.mse"),
n_repeats = 5
)
loco$compute()
loco$importance()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.