fastml: Guarded Resampling Workflows for Safer Automated Machine Learning in R
Organizations: Faculty of Medicine, Department of Biostatistics, Trakya University, Edirne 22030, Türkiye · Faculty of Medicine, Department of Biostatistics, Sakarya University, Sakarya 54290, Türkiye · Faculty of Medicine, Department of Biostatistics, University of Health Sciences, Ankara 06010, Türkiye
Abstract
Preprocessing leakage arises when scaling, imputation, or other data-dependent transformations are estimated before resampling, inflating apparent performance while remaining hard to detect. We present fastml, an R package that provides a single-call interface for leakage-aware machine learning through guarded resampling, where preprocessing is re-estimated inside each resample and applied to the corresponding assessment data. The package supports grouped and time-ordered resampling, blocks high-risk configurations, audits recipes for external dependencies, and includes sandboxed execution and integrated model explanation. We evaluate fastml with a Monte Carlo simulation contrasting global and fold-local normalization, a usability comparison with tidymodels under matched specifications, and survival benchmarks across datasets of different sizes. The simulation demonstrates that global preprocessing substantially inflates apparent performance relative to guarded resampling. fastml matched held-out performance obtained with tidymodels while reducing workflow orchestration, and it supported consistent benchmarking of multiple survival model classes through a unified interface.
Figures & tables
| Slot | Description | Practical guarantee |
|---|---|---|
| models | Fitted model objects, indexed by algorithm and engine | Models are stored as fitted objects; downstream predict / plot methods are intended to use stored fits rather than refitting. Reproducibility depends on package versions and environment consistency. |
| preprocessor | Stored preprocessing object | The stored preprocessor corresponds to the final training split ( train_data ), not to per-fold analysis subsets. Fold-local preprocessing occurs inside resampling when that path is used, but the stored final preprocessor is trained on the training split used for the final fit. |
| predictions | Stored predictions from evaluation | Predictions stored here are the holdout/test predictions produced during evaluation. Training-set predictions and per-fold resampling predictions are not necessarily stored in the same slot by default. |
| performance | Aggregated performance metrics | Metrics are computed from evaluation outputs (typically holdout/test predictions). If resampling is used, summary performance reflects the resampling results recorded by the resampling layer. |
| metric | Primary evaluation metric | Defines the main comparison target used in model reporting within the object. |
| best_model_name | Identifier of the default reference model | A presentation/default-selection label; it should not be interpreted as changing how metrics were computed. |
| Feature | caret (Legacy) | tidymodels (Modular) | mlr3 (High-Performance) | h2o (AutoML) | fastml (Guarded Facade) |
|---|---|---|---|---|---|
| Interface Philosophy | Unified Wrapper | Modular Pipeline | Object-Oriented | Integrated Engine | Guarded Facade |
| Function-based syntax (e.g., train() ) | Verbose composition (Recipe + Spec + Workflow) | R6 classes (Tasks, Learners, Graphs) | Server-client AutoML platform | Simplified single-function call ( fastml() ) | |
| Preprocessing and Leakage Control | Manual | Optional/User-Assembled | Robust / Graph-Based | Automated | Enforced Guarded Resampling |
| User must manually prevent leakage; error-prone. | Tools exist (recipes) but isolation is not enforced. | Pipelines define explicit graphs to handle flow. | Internal handling within the H2O engine. | Preprocessing is strictly re-estimated per fold by default. | |
| Survival Analysis Support | Basic | Expanding | Extensive | Standard | Native Hybrid |
| Primarily Cox Proportional Hazards | Via censored extension package. | Via mlr3 extensions. | Cox AFT models | Unified interface for Penalized Cox + Native XGBoost AFT & Piecewise Exp. |
| Dataset | Cox PH (Baseline) | Weibull AFT (Baseline) | fastml (Penalized Cox) | fastml (XGBoost AFT) | fastml (RF Survival) |
|---|---|---|---|---|---|
| Lung (N = 228) | 0.631 0.064 (0.530 to 0.716) | 0.633 0.062 (0.535 to 0.716) | 0.641 0.066 (0.528 to 0.739) | 0.618 0.050 (0.521 to 0.700) | 0.641 0.063 (0.517 to 0.734) |
| Rotterdam (N = 2,982) | 0.690 0.014 (0.669 to 0.713) | 0.690 0.014 (0.669 to 0.712) | 0.695 0.015 (0.673 to 0.718) | 0.705 0.012 (0.690 to 0.724) | 0.712 0.014 (0.688 to 0.730) |
| Flchain (N = 7,874) | 0.794 0.013 (0.775 to 0.817) | 0.794 0.013 (0.776 to 0.817) | 0.793 0.012 (0.776 to 0.816) | 0.795 0.014 (0.778 to 0.819) | 0.799 0.013 (0.784 to 0.823) |