fitMPRModelCV: fitMPRModelCV

View source: R/model_fitting.R

fitMPRModelCVR Documentation

fitMPRModelCV

Description

fitMPRModelCV

Usage

fitMPRModelCV(
  type,
  method,
  trainXs,
  trainY,
  testXs = NULL,
  testY = NULL,
  tteColname = "time_to_event",
  eventColname = "Event",
  parallel = FALSE,
  seed = NULL,
  save = TRUE,
  nFolds = 3,
  foldID = NULL,
  saveSuffix = NULL,
  ...
)

Arguments

type

A string representing the type of model. Can be 'binary', 'survival' or 'continuous'.

method

The modelling method. Currently supports 'glmnet', 'bart' and 'rf'.

trainXs

The training data matrix/data.frame.

trainY

The training response variable. This should be a vector if type = 'binary'/'continuous' or a data.frame/matrix with column names corresponding to tteColname and eventColname if type = 'survival'.

testXs

The test data matrix/data.frame.

testY

The test response variable. This should be a vector if type = 'binary'/'continuous' or a data.frame/matrix with column names corresponding to tteColname and eventColname if type = 'survival'.

tteColname

A string corresponding to the time-to-event column name in trainY/testY. Only required if type == 'survival'.

eventColname

A string corresponding to the event column name in trainY/testY. Only required if type == 'survival'.

parallel

A boolean specifying whether parallel computation should be used in model fitting.

seed

An integer to set the random seed to for model fitting.

save

A boolean specifying if the model object should be saved to the logs.

nFolds

The number of cross-validation folds to use.

foldID

A vector of integers with length equal to the number of rows in trainXs. Each element represents the fold number assigned to the corresponding row.

saveSuffix

Optional - a custom suffix to include in the file name of the saved model object after the timestamp.

...

The remaining parameters to be passed to the cross-validation function.

Value

Fits the specified model, selecting the best performing set of hyperparameters from a k-fold cross-validation using each combination of hyperparameters in a grid search.


marioni-group/MethylPipeR documentation built on Oct. 10, 2024, 3:32 p.m.