Skip to contents

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:

  1. prepare_model_pipeline(): Load and validate model configuration

  2. run_model_pipeline(): Apply transformations to data and retrieve the output of the model pipeline. The output is the results of the last transformation step. Depending on the step, this may include multiple columns.

Required Files

The pipeline requires the following CSV files:

Model Export

Points to variables and model-steps files

Variables

Lists predictor variables

Model Steps

Defines transformation sequence

Step Parameter Files

Define parameters for each transformation step

Examples

if (FALSE) { # \dontrun{
# Basic usage
mod <- prepare_model_pipeline("path/to/model-export.csv")
result <- run_model_pipeline(mod, x = "path/to/input-data.csv")

# 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, x = data_file)
  # Process result (a data frame)
}

# Pass a data frame to run_model_pipeline
input_data <- read.csv("path/to/input-data.csv")
result <- run_model_pipeline(mod, x = input_data)
} # }