plot.funnel_measure: Funnel plot for difference in measures

Description Usage Arguments Value Examples

View source: R/plot.funnel_measure.R

Description

Function plot.funnel_measure creates funnel plot of differences in measures for two models across variable areas. It uses data created with 'funnel_measure' function.

Usage

1
2
## S3 method for class 'funnel_measure'
plot(x, ..., dot_size = 0.5)

Arguments

x

- funnel_measure object created with funnel_measure function.

...

- other parameters

dot_size

- size of the dot on plots. Passed to geom_point.

Value

ggplot object

Examples

 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
library("mlr")
library("DALEXtra")
task <- mlr::makeRegrTask(
  id = "R",
  data = apartments,
  target = "m2.price"
)
learner_lm <- mlr::makeLearner(
  "regr.lm"
)
model_lm <- mlr::train(learner_lm, task)
explainer_lm <- explain_mlr(model_lm, apartmentsTest, apartmentsTest$m2.price, label = "LM")

learner_rf <- mlr::makeLearner(
  "regr.randomForest"
)
model_rf <- mlr::train(learner_rf, task)
explainer_rf <- explain_mlr(model_rf, apartmentsTest, apartmentsTest$m2.price, label = "RF")

learner_gbm <- mlr::makeLearner(
  "regr.gbm"
)
model_gbm <- mlr::train(learner_gbm, task)
explainer_gbm <- explain_mlr(model_gbm, apartmentsTest, apartmentsTest$m2.price, label = "GBM")


plot_data <- funnel_measure(explainer_lm, list(explainer_rf, explainer_gbm),
                            nbins = 5, measure_function = DALEX::loss_root_mean_square)
plot(plot_data)

DALEXtra documentation built on May 9, 2021, 9:07 a.m.