Description Usage Arguments Details Value Examples
View source: R/calculate_profiles_lce.R
This function Local Conditional Expectation profiles
1 2 | calculate_profiles_lce(data, variable_splits, model, dataset,
predict_function = predict, ...)
|
data |
set of observations. Profile will be calculated for every observation (every row) |
variable_splits |
named list of vectors. Elements of the list are vectors with points in which profiles should be calculated. See an example for more details. |
model |
a model that will be passed to the |
dataset |
a data.frame, usually training data of a model, used for calculation of LCE profiles |
predict_function |
function that takes data and model and returns numeric predictions. Note that the ... arguments will be passed to this function. |
... |
other parameters that will be passed to the |
Note that calculate_profiles_lce
function is S3 generic.
If you want to work on non standard data sources (like H2O ddf, external databases)
you should overload it.
a data frame with profiles for selected variables and selected observations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library("DALEX2")
## 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 = apartments[,2:6], y = apartments$m2.price)
vars <- c("construction.year", "surface", "floor", "no.rooms", "district")
variable_splits <- calculate_variable_splits(apartments, vars)
new_apartment <- apartments[1, ]
profiles <- calculate_profiles_lce(new_apartment, variable_splits,
apartments_rf_model, explainer_rf$data)
profiles
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.