df = mtcars2[, ! names(mtcars2) %in% 'ids' ]
m = randomForest::randomForest( disp ~ ., df)
imp = m$importance
pred = get_pdp_predictions(df, imp
, m
, degree = 3
, bins = 5)
# parallel processing --------------------------
if (FALSE) {
future::plan("multisession")
# note that we have to pass the predict method via .f_predict otherwise
# it will not be available in the worker's environment.
pred = get_pdp_predictions(df, imp
, m
, degree = 3
, bins = 5,
, parallel = TRUE
, .f_predict = randomForest:::predict.randomForest)
}
Run the code above in your browser using DataLab