Learn R Programming

PatientLevelPrediction (version 6.4.1)

createSampleSettings: Create the settings for defining how the trainData from splitData are sampled using default sample functions.

Description

Create the settings for defining how the trainData from splitData are sampled using default sample functions.

Usage

createSampleSettings(
  type = "none",
  numberOutcomestoNonOutcomes = 1,
  sampleSeed = sample(10000, 1)
)

Value

An object of class sampleSettings

Arguments

type

(character) Choice of:

  • 'none' No sampling is applied - this is the default

  • 'underSample' Undersample the non-outcome class to make the data more balanced

  • 'overSample' Oversample the outcome class by adding in each outcome multiple times

numberOutcomestoNonOutcomes

(numeric) A numeric specifying the required number of outcomes per non-outcomes

sampleSeed

(numeric) A seed to use when splitting the data for reproducibility (if not set a random number will be generated)

Details

Returns an object of class sampleSettings that specifies the sampling function that will be called and the settings

Examples

Run this code
if (FALSE) { # rlang::is_installed("Eunomia")
# \donttest{
# sample even rate of outcomes to non-outcomes
sampleSetting <- createSampleSettings(
  type = "underSample",
  numberOutcomestoNonOutcomes = 1,
  sampleSeed = 42
)
# }
}

Run the code above in your browser using DataLab