This function should only be called internally, and not be used as a stand-alone function.
prediction(dt, prediction_zero, explainer)data.table
Numeric. The value to use for phi_0.
An object of class explainer. See shapr.
An object of class c("shapr", "list"). For more details see explain.
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.