The cross-validation function cv.glmnet, for regularized regression, does not seem to allow for separate transformation/preprocessing of training and validation datasets. As full dataset transformation may lead to data leakage, how can I work around this?
Related question: Does the standardization by glmnet (which is standard, but can be turned off) separate training and validation data?