Loads all PI model RDS files from a directory into a list. Automatically detects whether models are LASSO (glmnet) or GLM type.

load_PI_models(model_dir, pattern = "^model_.*\\.rds$")

Arguments

model_dir

Character. Path to directory containing model_*.rds files.

pattern

Character. Regex pattern for model file names. Default: "^model_.*\.rds$"

Value

List with components:

models

List of fitted model objects

model_type

"LASSO" or "GLM" (auto-detected from first model)

n_models

Number of models loaded

model_dir

Source directory path

Examples

if (FALSE) { # \dontrun{
# Load models from directory
result <- load_PI_models("path/to/piModels/")
cat("Loaded", result$n_models, result$model_type, "models\n")
} # }