test_models {promor}R Documentation

Test machine learning models on test data

Description

This function can be used to predict test data using models generated by different machine learning algorithms

Usage

test_models(
  model_list,
  split_df,
  type = "prob",
  save_confusionmatrix = FALSE,
  file_path = NULL,
  ...
)

Arguments

model_list

A model_list object from performing train_models.

split_df

A split_df object from performing split_data.

type

Type of output. Set type as "prob" (default) to output class probabilities, and "raw" to output class predictions.

save_confusionmatrix

Logical. If TRUE, a tab-delimited text file ("Confusion_matrices.txt") with confusion matrices in the long-form data format will be saved in the directory specified by file_path. See below for more details.

file_path

A string containing the directory path to save the file.

...

Additional arguments to be passed on to predict.

Details

Value

Author(s)

Chathurani Ranathunge

See Also

Examples


## 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)


[Package promor version 0.2.1 Index]