View source: R/ExternalValidatePlp.R
externalValidateDbPlp | R Documentation |
This function extracts data using a user specified connection and cdm_schema, applied the model and then calcualtes the performance
externalValidateDbPlp(
plpModel,
validationDatabaseDetails = createDatabaseDetails(),
validationRestrictPlpDataSettings = createRestrictPlpDataSettings(),
settings = createValidationSettings(recalibrate = "weakRecalibration"),
logSettings = createLogSettings(verbosity = "INFO", logName = "validatePLP"),
outputFolder = NULL
)
plpModel |
The model object returned by runPlp() containing the trained model |
validationDatabaseDetails |
A list of objects of class |
validationRestrictPlpDataSettings |
A list of population restriction settings created by |
settings |
A settings object of class |
logSettings |
An object of |
outputFolder |
The directory to save the validation results to (subfolders are created per database in validationDatabaseDetails) |
Users need to input a trained model (the output of runPlp()) and new database connections. The function will return a list of length equal to the number of cdm_schemas input with the performance on the new data
An externalValidatePlp object containing the following components
model: The model object
executionSummary: A list of execution details
prediction: A dataframe containing the predictions
performanceEvaluation: A dataframe containing the performance metrics
covariateSummary: A dataframe containing the covariate summary
data("simulationProfile")
plpData <- simulatePlpData(simulationProfile, n=1000)
# first fit a model on some data, default is a L1 logistic regression
saveLoc <- file.path(tempdir(), "development")
results <- runPlp(plpData,
outcomeId = 3,
saveDirectory = saveLoc,
populationSettings =
createStudyPopulationSettings(requireTimeAtRisk=FALSE)
)
connectionDetails <- Eunomia::getEunomiaConnectionDetails()
Eunomia::createCohorts(connectionDetails)
# now validate the model on Eunomia
validationDatabaseDetails <- createDatabaseDetails(
connectionDetails = connectionDetails,
cdmDatabaseSchema = "main",
cdmDatabaseName = "main",
cohortDatabaseSchema = "main",
cohortTable = "cohort",
outcomeDatabaseSchema = "main",
outcomeTable = "cohort",
targetId = 1, # users of celecoxib
outcomeIds = 3, # GIbleed
cdmVersion = 5)
path <- file.path(tempdir(), "validation")
externalValidateDbPlp(results$model, validationDatabaseDetails, outputFolder = path)
# clean up
unlink(saveLoc, recursive = TRUE)
unlink(path, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.