organizing data processing and model training functions for efficiency