This function runs multiple iterations/experiments over the dataset across different cell counts, and computes the MAE. If a given cell configuration not results in problematic states, the baseline simulation is used; otherwise, the simulation proceeds with problematic state handling. This process helps identify the best-performing model (lowest MAE). In essence, it performs trainHVT → scoreHVT → transition probability estimation on the training data, followed by msm simulation on the ex-post (test) dataset. Note: This is not applicable for ex-ante analysis.
HVTMSMoptimization(
entire_dataset,
expost_forecasting,
time_column,
ncell_range = 3:5,
k_range = 2:9,
nn_range = 2:7,
num_simulations = 10,
mae_metric,
hvt_params = list(depth = 1, quant.err = 0.2, normalize = TRUE, distance_metric =
"L1_Norm", error_metric = "max", dim_reduction_method = "sammon"),
parallel = TRUE,
verbose = TRUE,
parallel_strategy = "multisession",
max_workers = NULL
)List containing optimization results for each MAE metric:
All successful parameter combinations
Best combination for each cell
Overall best parameter combination
All attempted combinations with status
Dataframe. Train dataset for model training
Dataframe. Test dataset for ex-post forecasting
Character. Name of the time column
Numeric vector. Range of cells to run experiments (default 3:5)
Numeric vector. Range of clusters to run experiments (default: 2:9)
Numeric vector. Range of nearest neighbors to run experiments (default: 2:7)
Integer. Number of simulations (default: 10)
Character. MAE calculation method(s): "mean", "median", "mode", or "all" (default: "median")
List. Set of parameters for Model Training (refer trainHVT)
Character. Whether to use parallel processing (default: TRUE)
Character. Whether to print progress information (default: TRUE)
Character. Parallel processing strategy: "multisession", "multicore", etc. (default: "multisession")
Maximum number of parallel workers (default: NULL for auto-detect)
Vishwavani <vishwavani@mu-sigma.com>, Nithya <nithya.sn@mu-sigma.com>