This module provides functions to prepare and run a model parameters pipeline for applying sequential data transformations as defined by the Model Parameters specification developed by Big Life Lab.
Workflow
The typical workflow involves two steps:
prepare_model_pipeline(): Load and validate model configurationrun_model_pipeline(): Apply transformations to data
Required Files
The pipeline requires the following CSV files:
- Model Export
Points to variables and model-steps files (columns: fileType, filePath)
- Variables
Lists predictor variables (columns: variable, role)
- Model Steps
Defines transformation sequence (columns: step, filePath)
- Step Parameter Files
Define parameters for each transformation step
Examples
if (FALSE) { # \dontrun{
# Basic usage
mod <- prepare_model_pipeline("path/to/model-export.csv")
mod <- run_model_pipeline(mod, data = "path/to/input-data.csv")
# Access transformed data
transformed_data <- mod$df
# Processing multiple datasets with the same model
mod <- prepare_model_pipeline("path/to/model-export.csv")
for (data_file in data_files) {
result <- run_model_pipeline(mod, data = data_file)
# Process result$df
}
# Pass a data frame to run_model_pipeline
input_data <- read.csv("path/to/input-data.csv")
mod <- run_model_pipeline(mod, data = input_data)
# Extract logistic predictions (if model includes logistic-regression step)
predictions <- mod$df[, grep("^logistic_", names(mod$df))]
} # }