View source: R/mrPD_bootstrap.R
mrPD_bootstrap | R Documentation |
This function bootstraps model predictions and generates partial dependence plots for each response variable. It also creates a combined plot for the top variables of interest.
mrPD_bootstrap(mrBootstrap_obj, vi_obj, X, Y, target, global_top_var = 2)
mrBootstrap_obj |
A list of model bootstraps generated using mrBootstrap function. |
vi_obj |
Variable Importance data. |
X |
The predictor data. |
Y |
The response data. |
target |
The target variable for generating plots. |
global_top_var |
The number of top variables to consider (default: 2). |
A list containing the partial dependence plots for each response variable and a combined plot.
## Not run:
#' # Example usage:
#set up analysis
Y <- dplyr::select(Bird.parasites, -scale.prop.zos)%>%
dplyr::select(sort(names(.)))#response variables eg. SNPs, pathogens, species....
X <- dplyr::select(Bird.parasites, scale.prop.zos) # feature set
X1 <- Y %>%
dplyr::select(sort(names(.)))
model_rf <-
rand_forest(trees = 100, mode = "classification", mtry = tune(), min_n = tune()) %>% #100 trees are set for brevity. Aim to start with 1000
set_engine("randomForest")
yhats_rf <- mrIMLpredicts(X=X, Y=Y,
X1=X1,'Model=model_rf ,
balance_data='no',mode='classification',
tune_grid_size=5,seed = sample.int(1e8, 1),'morans=F,
prop=0.7, k=5, racing=T) #
bs_analysis <- mrBootstrap(yhats=yhats_rf,Y=Y, num_bootstrap = 5)
pds <- mrPD_bootstrap(mrBootstrap_obj=bs_malaria, vi_obj=bs_impVIa, X, Y,
target='Plas', global_top_var=5)
pd_list <- pds[[1]] #data
pds[[2]]#plot
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.