View source: R/mrInteractions.R
mrInteractions | R Documentation |
This function calculates and visualizes interactions in the model using bootstrapping. It provides overall, one-way, and two-way interactions for specified features.
mrInteractions(yhats, X, Y, num_bootstrap = 1, feature = feature, top.int = 10)
yhats |
A list of model predictions. |
X |
The predictor data. |
Y |
The response data. |
num_bootstrap |
The number of bootstrap samples to generate (default: 1). |
feature |
The feature for which interactions need to be calculated. |
top.int |
The number of top interactions to display (default: 10). |
A list containing the visualizations for overall, one-way, and two-way interactions, as well as the interaction dataframes.
## 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)
int_ <- mrInteractions(yhats=yhats_rf, X, Y, num_bootstrap=10,
feature = 'Microfilaria', top.int=10)
int_[[1]] # overall plot
int_[[2]] # individual plot for the response of choice
int_[[3]] #two way plot#
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.