imlplots: interpretable machine learning plots

imlplots is an R package that provide an interactive Shiny dashboard for three kinds of Interpretable Machine Learning (IML) plots

library(knitr)
opts_chunk$set(echo=TRUE, warning=FALSE, message=FALSE)
set.seed(42)
load("data/boston.rda")
library(mlr)

Installation

The package can be installed directly from github with devtools

# install.packages("devtools")
devtools::install_github('juliafried/imlplots')
library(imlplots)

Quickstart

You can fit classification and regression problems from the mlr package and analyse possible interaction effects in a Shiny dasbhoard.

For quickstart we take the popular Boston Housing data, where we want to predict the median housing price in Boston.

print(summarizeColumns(boston)[, -c(5, 6, 7)], digits = 4)

For using imlplots Shiny dashboard, three input arguments need to be specified

We create a regression task with medv as target variable. The task structure is determined by mlr package.

boston.task = makeRegrTask(data = boston, target = "medv")

The imlplots dashboard allows the comparison of multiple learning algorithms, therefore we fit two different models - first a random forest and second a GLM.

rf.mod = train("regr.randomForest", boston.task)
glm.mod = train("regr.glm", boston.task)

The input for the Shiny app is a list of learners.

mod.list = list(rf.mod, glm.mod)

Now the Shiny app can be used.

imlplots(data = boston, task = boston.task, models = mod.list)

Code for Copy & Paste

boston.task = makeRegrTask(data = boston, target = "medv")

rf.mod = train("regr.randomForest", boston.task)
glm.mod = train("regr.glm", boston.task)
mod.list = list(rf.mod, glm.mod)

imlplots(data = boston, task = boston.task, models = mod.list)

Further Examples

References



juliafried/imlplots documentation built on May 29, 2019, 10:38 a.m.