/** * Evaluate an iterative recommender on the folds of a dataset split, display results on STDOUT. * * @param recommender a rating predictor * @param num_folds the number of folds * @param max_iter the maximum number of iterations * @param find_iter the report interval * @throws Exception */ public static void doIterativeCrossValidation( RatingPredictor recommender, int num_folds, int max_iter, Integer find_iter) throws Exception { RatingCrossValidationSplit split = new RatingCrossValidationSplit(recommender.getRatings(), num_folds); doIterativeCrossValidation(recommender, split, max_iter, find_iter); }
/** * Evaluate on the folds of a dataset split. * * @param recommender a rating predictor * @param num_folds the number of folds * @param compute_fit if set to true measure fit on the training data as well * @param show_results if set to true to print results to STDERR * @return a dictionary containing the average results over the different folds of the split * @throws Exception */ public static RatingPredictionEvaluationResults doCrossValidation( RatingPredictor recommender, Integer num_folds, Boolean compute_fit, Boolean show_results) throws Exception { if (num_folds == null) num_folds = 5; if (compute_fit == null) compute_fit = false; if (show_results == null) show_results = false; RatingCrossValidationSplit split = new RatingCrossValidationSplit(recommender.getRatings(), num_folds); return doCrossValidation(recommender, split, compute_fit, show_results); }