Creates a structured directory hierarchy for storing machine learning results including matrices, performance metrics, feature importance, models, and predictions.

createMLResultDir(
  path,
  stratify_by = NULL,
  LOO = FALSE,
  cross_test = FALSE,
  MDR = FALSE
)

Arguments

path

Character scalar. Base directory path where subdirectories will be created.

stratify_by

Character scalar or NULL. Stratification method: "country", "year", or NULL. Default is NULL (no stratification).

LOO

Logical. Whether to create directories for Leave-One-Out analysis. Default is FALSE. Only valid when stratify_by is not NULL.

cross_test

Logical. Whether to create directories for cross-testing. Default is FALSE.

MDR

Logical. Whether to create directories for Multi-Drug Resistance (MDR) analysis. Default is FALSE. When TRUE, all other parameters must be FALSE/NULL.

Value

A named list containing paths to:

matrix_path

Directory for input matrices

ML_performance

Directory for performance metrics

ML_top_features

Directory for top feature rankings

ML_models

Directory for saved model objects

ML_prediction

Directory for prediction results

Examples

if (FALSE) { # \dontrun{
# Basic directory structure
paths <- createMLResultDir("/path/to/results")

# LOO analysis stratified by year
paths_loo <- createMLResultDir("/path/to/results",
                                stratify_by = "year",
                                LOO = TRUE)

# MDR analysis
paths_mdr <- createMLResultDir("/path/to/results", MDR = TRUE)
} # }