Learn R Programming

PatientLevelPrediction (version 3.0.0)

createLearningCurvePar: createLearningCurvePar

Description

Creates a learning curve in parallel, which can be plotted using the plotLearningCurve() function. Currently this functionality is only supported by Lasso Logistic Regression.

Usage

createLearningCurvePar(population, plpData, modelSettings,
  testSplit = "person", testFraction = 0.25, trainFractions = c(0.25, 0.5,
  0.75), splitSeed = NULL, nfold = 3, indexes = NULL,
  minCovariateFraction = 0.001)

Arguments

population

The population created using createStudyPopulation() that will be used to develop the model.

plpData

An object of type plpData - the patient level prediction data extracted from the CDM.

modelSettings

An object of class modelSettings created using one of the function. Currently only one model is supported:

  • setLassoLogisticRegression - a lasso logistic regression model

testSplit

Specifies the type of evaluation used. Can be either 'person' or 'time'. The value 'time' finds the date that splots the population into the testing and training fractions provided. Patients with an index after this date are assigned to the test set and patients with an index prior to this date are assigned to the training set. The value 'person' splits the data randomly into testing and training sets according to fractions provided. The split is stratified by the class label.

testFraction

The fraction of the data, which will be used as the testing set in the patient split evaluation.

trainFractions

A list of training fractions to create models for.

splitSeed

The seed used to split the testing and training set when using a 'person' type split

nfold

The number of folds used in the cross validation (default = 3).

indexes

A dataframe containing a rowId and index column where the index value of -1 means in the test set, and positive integer represents the cross validation fold (default is NULL).

minCovariateFraction

Minimum covariate prevalence in population to avoid removal during preprocssing.

Value

A learning curve object containing the various performance measures obtained by the model for each training set fraction. It can be plotted using plotLearningCurve.

Examples

Run this code
# NOT RUN {
# define model
modelSettings = setLassoLogisticRegression()

# register parallel backend
registerParallelBackend()

# create learning curve
learningCurve <- createLearningCurvePar(population,
                                        plpData,
                                        modelSettings)
# plot learning curve
plotLearningCurve(learningCurve)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab