This function works for explain objects. It calles embeded predict function.

# S3 method for explainer
predict(object, newdata, ...)

Arguments

object

a model to be explained, object of the class 'explainer'

newdata

data.frame or matrix - observations for prediction

...

other parameters that will be passed to the predict function

Value

An numeric matrix of predictions

Examples

HR_glm_model <- glm(status == "fired"~., data = HR, family = "binomial") explainer_glm <- explain(HR_glm_model, data = HR) predict(explainer_glm, HR[1:3,])
#> 1 2 3 #> 0.5139357 0.7384469 0.6412859
library("randomForest") HR_rf_model <- randomForest(status == "fired" ~., data = HR)
#> Warning: The response has five or fewer unique values. Are you sure you want to do regression?
explainer_rf <- explain(HR_rf_model, data = HR) predict(explainer_rf, HR[1:3,])
#> 1 2 3 #> 0.5587188 0.7488287 0.7383894