Skip to content

Commit 6a6d3d5

Browse files
committed
try new vignette
1 parent f85baba commit 6a6d3d5

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

vignettes/ms-rmarkdown.Rmd

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: "modelStudio in R Markdown HTML"
3+
author: "Hubert Baniecki"
4+
date: "`r Sys.Date()`"
5+
output: rmarkdown::html_vignette
6+
vignette: >
7+
%\VignetteIndexEntry{modelStudio in R Markdown HTML}
8+
%\VignetteEngine{knitr::rmarkdown}
9+
%\VignetteEncoding{UTF-8}
10+
---
11+
12+
<!-- STYLES FOR modelStudio -->
13+
<style type="text/css">
14+
.r2d3 {
15+
position: relative !important;
16+
left: -250px !important;
17+
}
18+
</style>
19+
20+
21+
```{r setup, include=FALSE}
22+
knitr::opts_chunk$set(echo = TRUE)
23+
```
24+
25+
To properly generate `modelStudio` in R Markdown HTML, add additional CSS into the `.Rmd` file.
26+
27+
One can either make the space wider, e.g.:
28+
29+
```
30+
<!-- STYLES FOR modelStudio -->
31+
<style type="text/css">
32+
33+
.body {
34+
max-width: 1200px;
35+
}
36+
37+
.main-container {
38+
max-width: 1200px;
39+
}
40+
41+
</style>
42+
```
43+
44+
Or/and move the dashboard to the left, e.g.:
45+
46+
```
47+
<style type="text/css">
48+
49+
.r2d3 {
50+
position: relative !important;
51+
left: -250px !important;
52+
}
53+
54+
</style>
55+
```
56+
57+
Then, proceed to generate the `modelStudio`:
58+
59+
```{r warning = FALSE, message = FALSE}
60+
library("DALEX")
61+
library("ranger")
62+
library("modelStudio")
63+
64+
# fit a model
65+
model <- ranger(score ~., data = happiness_train)
66+
67+
# create an explainer for the model
68+
explainer <- explain(model,
69+
data = happiness_test,
70+
y = happiness_test$score,
71+
label = "Random Forest",
72+
verbose = FALSE)
73+
74+
# make a studio for the model
75+
modelStudio(explainer)
76+
```

0 commit comments

Comments
 (0)