Use selected model design settings to create a model design for hold-out data. The hold-out data can be out-of-sample data or subsetted data for k-fold cross validation.
Usage
model_design_outsample(
project,
mod.name,
outsample.mod.name = NULL,
CV = FALSE,
CV_dat = NULL,
use.scalers = FALSE,
scaler.func = NULL
)
Arguments
- project
Name of project
- mod.name
Name of saved model to use. Argument can be the name of the model or can pull the name of the saved "best" model. Leave
mod.name
empty to use the saved "best" model. If more than one model is saved,mod.name
should be the numeric indicator of which model to use. Usetable_view("modelChosen", project)
to view a table of saved models.- outsample.mod.name
Name assigned to out-of-sample model design. Must be unique and not already exist in model design list. If
outsample.mod.name = NULL
then a default name will be chosen based on mod.name, which is the default value.- CV
Logical, Indicates whether the model design is being created for cross validation
TRUE
, or for simple out- of-sample dataset. Defaults toCV = TRUE
.- CV_dat
Training or testing dataset for k-fold cross validation.
- use.scalers
Input for
create_model_input()
. Logical, should data be normalized? Defaults toFALSE
. Rescaling factors are the mean of the numeric vector unless specified withscaler.func
.- scaler.func
Input for
create_model_input()
. Function to calculate rescaling factors.
Details
This function automatically pulls model settings from the selected model and creates an alternative choice matrix, expected catch/revenue matrices,
and model design for a hold-out dataset. The hold-out data set can be an out-of-sample dataset or subset of main data for cross validation.
If running out-of-sample data, this function requires that a filtered out-of-sample data file (.rds file) exists in the output folder. For cross
validation, this function is called in the cross_validation()
function.
Note: the out-of-sample functions only work with a single selected model at a time. To run out-of-sample functions on a new
out-of-sample dataset, start with load_outsample() if an entirely new dataset or filter_outsample().