Use Factory in cross-validation