View source: R/modelProteins.R
test_models | R Documentation |
This function can be used to predict test data using models generated by different machine learning algorithms
test_models(
model_list,
split_df,
type = "prob",
save_confusionmatrix = FALSE,
file_path = NULL,
...
)
model_list |
A |
split_df |
A |
type |
Type of output. Set |
save_confusionmatrix |
Logical. If |
file_path |
A string containing the directory path to save the file. |
... |
Additional arguments to be passed on to
|
test_models
function uses
models obtained from train_models
to predict a given test data set.
Setting type = "raw"
is required to obtain confusion matrices.
Setting type = "prob"
(default) will output a list of
probabilities that can be used to generate ROC curves using roc_plot
.
probability_list
: If type = "prob"
, a list of
data frames containing class probabilities for each method in the
model_list
will be returned.
prediction_list
: If type = "raw"
, a list of factors
containing class predictions for each method will be returned.
Chathurani Ranathunge
split_df
train_models
predict
confusionMatrix
## Create a model_df object
covid_model_df <- pre_process(covid_fit_df, covid_norm_df)
## Split the data frame into training and test data sets
covid_split_df <- split_data(covid_model_df)
## Fit models using the default list of machine learning (ML) algorithms
covid_model_list <- train_models(covid_split_df)
# Test a list of models on a test data set and output class probabilities,
covid_prob_list <- test_models(model_list = covid_model_list, split_df = covid_split_df)
## Not run:
# Save confusion matrices in the working directory and output class predictions
covid_pred_list <- test_models(
model_list = covid_model_list,
split_df = covid_split_df,
type = "raw",
save_confusionmatrix = TRUE,
file_path = "."
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.