Fit Local Linear Model and Compute Feature Importance
Usage
fit_local_model(
perturbations,
predictor_vars,
nfolds = 50,
alpha = 1,
class_names = c("A", "B")
)Arguments
- perturbations
Data frame of perturbations with predictions
- predictor_vars
Character vector of predictor variable names
- nfolds
Number of folds for cross-validation (default: 50)
- alpha
Elastic net mixing parameter (default: 1 for lasso)
- class_names
Character vector of class names for binary classification
Examples
perturbations <- data.frame(
x1 = c(1, 2, 3),
x2 = c(4, 5, 6),
pred = c("A", "A", "A")
)
result <- fit_local_model(
perturbations,
predictor_vars = c("x1", "x2")
)