local_fit: Local Fit / Wangkardu Explanations

Description Usage Arguments Value Examples

View source: R/coral_plots.R

Description

Local Fit / Wangkardu Explanations

Usage

1
2
3
4
5
6
7
local_fit(
  explainer,
  observation,
  selected_variable,
  grid_points = 101,
  select_points = 0.1
)

Arguments

explainer

a model to be explained, preprocessed by the 'DALEX::explain' function

observation

a new observarvation for which predictions need to be explained

selected_variable

variable to be presented in the local fit plot

grid_points

number of points used for response path

select_points

fraction of points fromvalidation data to be presented in local fit plots

Value

An object of the class 'local_fit_explainer'. It's a data frame with calculated average responses.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library("DALEX")
 ## Not run: 
library("randomForest")
set.seed(59)

apartments_rf_model <- randomForest(m2.price ~ construction.year + surface + floor +
      no.rooms + district, data = apartments)

explainer_rf <- explain(apartments_rf_model,
      data = apartmentsTest[,2:6], y = apartmentsTest$m2.price)

new_apartment <- apartmentsTest[1, ]
new_apartment

cr_rf <- local_fit(explainer_rf, observation = new_apartment,
    select_points = 0.002, selected_variable = "surface")
cr_rf

## End(Not run)

ceterisParibus documentation built on March 31, 2020, 5:22 p.m.