Description Usage Arguments Details Value Author(s)
This function should only be called internally, and not be used as a standalone function.
1  prediction(dt, prediction_zero, explainer)

dt 
data.table 
prediction_zero 
Numeric. The value to use for 
explainer 
An object of class 
If dt
does not contain three columns called id
, id_combination
and w
the function will fail. id
represents a unique key for a given test observation,
and id_combination
is a unique key for which feature combination the row represents. w
represents the Shapley value of feature combination given by id_combination
. In addition
to these three columns, dt
should also have columns which matches the variables used
when training the model.
I.e. you have fitted a linear model using the features x1
,
x2
and x3
, and you want to explain 5 test observations using the exact method, i.e.
setting exact = TRUE
in shapr
, the following properties should be satisfied
colnames(dt)
equals c("x1", "x2", "x3", "id", "id_combination", ""w)
dt[, max(id)]
equals the number of test observations
dt[, min(id)]
equals 1L.
dt[, max(id_combination)]
equals 2^m
where m equals the number of features.
dt[, min(id_combination)]
equals 1L.
dt[, type(w)]
equals double
.
An object of class c("shapr", "list")
. For more details see explain
.
Nikolai Sellereite
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.