View source: R/mrIMLpredicts.R
mrIMLpredicts | R Documentation |
Wrapper to generate multi-response predictive models.
mrIMLpredicts(
X,
X1 = NULL,
Y,
Model,
balance_data = "no",
mode = "regression",
dummy = FALSE,
prop = 0.5,
morans = F,
tune_grid_size = 10,
k = 10,
racing = T,
seed = sample.int(1e+08, 1)
)
X |
A |
X1 |
A |
Y |
A |
Model |
1 A |
balance_data |
A |
mode |
|
dummy |
A |
morans |
|
tune_grid_size |
A |
k |
A |
racing |
|
seed |
A |
This function produces yhats that used in all subsequent functions. This function fits separate classification/regression models for each response variable in a data set. Rows in X (features) have the same id (host/site/population) as Y. Class imbalance can be a real issue for classification analyses. Class imbalance can be addressed for each response variable using 'up' (upsampling using ROSE bootstrapping), 'down' (downsampling) or 'no' (no balancing of classes).
all_cores <- parallel::detectCores(logical = FALSE)
cl <- makePSOCKcluster(all_cores)
registerDoParallel(cl)
model1 <-
rand_forest(trees = 100, mode = "classification") %>% #this should cope with multinomial data alreadf
set_engine("ranger", importance = c("impurity","impurity_corrected")) %>% #model is not tuned to increase computational speed
set_mode("classification")
yhats <- mrIMLpredicts(X= enviro_variables,Y=response_data, model1=model1, balance_data='no', model='classification',
tune_grid_size=5, k=10, seed = sample.int(1e8, 1)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.