Learn R Programming

viruslearner (version 0.0.2)

cd_ens: CD4 Cell Count or Viral Load Ensemble Learning Through Stacking of Models.

Description

Stacking ensemble approach to combine predictions from various models, allowing for grid search of tuning hyperparameters.

Usage

cd_ens(
  outcome,
  traindata,
  viralvars,
  logbase,
  seed,
  repetitions,
  gridsize,
  mode = TRUE,
  type = TRUE
)

Value

A stacked ensemble model or individual models based on the specified type.

Arguments

outcome

The name of the outcome variable.

traindata

The training dataset.

viralvars

Vector of variable names related to viral data.

logbase

The base for logarithmic transformations.

seed

Seed for reproducibility.

repetitions

Number of repetitions for cross-validation.

gridsize

Size of the grid for hyperparameter tuning.

mode

Is the mode of the model regression? "regression" (TRUE) or "classification" (FALSE).

type

Is the type of modeling ensemble? "ensemble" (TRUE) or "individual" (FALSE).

Examples

Run this code
# \donttest{
library(baguette)
library(kernlab)
library(kknn)
library(ranger)
library(rules)
data("cd_train", package = "viruslearner")
outcome <- "cd_2023"
traindata <- cd_train
viralvars <- c("vl_2019", "vl_2021", "vl_2022", "vl_2023")
logbase <- 10
seed <- 1501
repetitions <- 2
gridsize <- 1
set.seed(123)
cd_ens(outcome, traindata, viralvars, logbase, seed, repetitions, gridsize, TRUE, TRUE)
# }

Run the code above in your browser using DataLab