Skip to content
Back to skills

Iml

ASecurity

R iml package for interpretable ML. Use for model-agnostic interpretability methods.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 4, 2026
data

Security analysis

A100/100

Scanned June 4, 2026

npx -y skills add LeoLin990405/r-analytics-skill --skill iml --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Iml?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Iml
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/leolin990405-iml/badge)](https://www.skillsdirectory.com/skills/leolin990405-iml)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: iml
description: R iml package for interpretable ML. Use for model-agnostic interpretability methods.
---

# iml

Interpretable Machine Learning.

## Create Predictor

```r
library(iml)

# Create predictor object
predictor <- Predictor$new(
  model = model,
  data = train_data,
  y = train_labels
)
```

## Feature Importance

```r
# Permutation importance
imp <- FeatureImp$new(predictor, loss = "mse")
plot(imp)

# Results
imp$results
```

## Partial Dependence

```r
# Single feature
pdp <- FeatureEffect$new(predictor, feature = "age")
plot(pdp)

# Method options
pdp <- FeatureEffect$new(predictor, feature = "age",
  method = "pdp")      # Partial dependence
pdp <- FeatureEffect$new(predictor, feature = "age",
  method = "ale")      # Accumulated local effects
pdp <- FeatureEffect$new(predictor, feature = "age",
  method = "pdp+ice")  # PDP + ICE
```

## Feature Interactions

```r
# Two-way interaction
interact <- Interaction$new(predictor)
plot(interact)

# Specific feature
interact <- Interaction$new(predictor, feature = "age")
```

## SHAP Values

```r
# Shapley values for single prediction
shap <- Shapley$new(predictor, x.interest = new_data[1, ])
plot(shap)

# Results
shap$results
```

## LIME

```r
# Local interpretable model
lime <- LocalModel$new(predictor, x.interest = new_data[1, ])
plot(lime)

# Results
lime$results
```

## Surrogate Model

```r
# Global surrogate
tree <- TreeSurrogate$new(predictor, maxdepth = 3)
plot(tree)

# Predict with surrogate
tree$predict(new_data)
```

## Counterfactuals

```r
# What-if counterfactuals
library(counterfactuals)
cf <- Counterfactuals$new(predictor, x.interest = new_data[1, ])
cf$find_counterfactuals(desired_outcome = 1)
```

## Multiple Features

```r
# 2D PDP
pdp2d <- FeatureEffect$new(predictor,
  feature = c("age", "income"),
  method = "pdp")
plot(pdp2d)
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.