Add support for cross validation in deep pretraining