Description Usage Arguments Examples
Apply trained ensemble model on new data Apply a Patient Level Prediction model on Patient Level Prediction Data and get the predicted risk in [0,1] for each person in the population. If the user inputs a population with an outcomeCount column then the function also returns the evaluation of the prediction (AUC, brier score, calibration)
1 2 3 4 5 6 7 | applyEnsembleModel(
population,
dataList,
ensembleModel,
analysisId = NULL,
calculatePerformance = T
)
|
population |
The population of people who you want to predict the risk for |
dataList |
The plpData list for the population |
ensembleModel |
The trained ensemble model returned by running runEnsembleModel |
analysisId |
The analysis ID, which is the ID of running ensemble model training. |
calculatePerformance |
Whether to also calculate the performance metrics [default TRUE] |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Not run:
# load the model and data
plpData <- loadPlpData("plpdata/")
results <- PatientLevelPrediction::runEnsembleModel(population,
dataList = list(plpData, plpData),
modelList = list(model, model),
testSplit = "person",
testFraction = 0.2,
nfold = 3,
splitSeed = 1000,
ensembleStrategy = "stacked")
# use the same population settings as the model:
populationSettings <- plpModel$populationSettings
populationSettings$plpData <- plpData
population <- do.call(createStudyPopulation, populationSettings)
# get the prediction, please make sure the ensemble strategy for training and apply is the same:
prediction <- applyEnsembleModel(population,
dataList = list(plpData, plpData),
ensembleModel = results,
analysisId = NULL)$prediction
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.