-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME.Rmd
91 lines (65 loc) · 2.47 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
output: github_document
editor_options:
chunk_output_type: console
---
# 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
* Partial Dependence Plots (PDP)
* Individual Conditional Expectation (ICE) plots
* Accumulated Local Effect (ALE) plots
```{r global_options, include=FALSE}
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
```{r, results = 'hide', eval = FALSE}
# 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.
```{r}
print(summarizeColumns(boston)[, -c(5, 6, 7)], digits = 4)
```
For using `imlplots` Shiny dashboard, three input arguments need to be specified
* `data` - the input data
* `task`- the learning task
* `models` - one or several trained models
We create a regression task with `medv` as target variable.
The task structure is determined by `mlr` package.
```{r}
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.
```{r}
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.
```{r}
mod.list = list(rf.mod, glm.mod)
```
Now the Shiny app can be used.
```{r, eval=FALSE}
imlplots(data = boston, task = boston.task, models = mod.list)
```
## Code for Copy & Paste
```{r, eval=FALSE}
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
* Check out our [Wiki](https://github.com/juliafried/imlplots/wiki)
* [Vignette](https://github.com/juliafried/imlplots/raw/master/vignettes/imlplots.pdf)
# References
* [References](https://github.com/juliafried/imlplots/raw/master/paper/references.pdf)