/** * Calls the {@code CrossfoldCommand} and adds the resulting {@code TTDataSet}s to the {@code * TrainTestEvalCommand}. * * <p>Any exceptions that are thrown are wrapped as {@code RuntimeExceptions}. * * @param cross * @return Itself to allow for method chaining. */ public SimpleEvaluator addDataset(CrossfoldTask cross) { cross.setProject(project); try { for (TTDataSet data : cross.perform()) { result.addDataset(data); } } catch (TaskExecutionException e) { throw new RuntimeException(e); } return this; }
/** * Constructs a new {@code CrossfoldCommand} and configures it before adding the datasets to the * {@code TrainTestEvalCommand}. * * @param name The name of the crossfold * @param source The source for the crossfold * @param partitions The number of partitions * @param holdout The holdout fraction * @return Itself for chaining. */ public SimpleEvaluator addDataset( String name, DataSource source, int partitions, double holdout) { CrossfoldTask cross = new CrossfoldTask(name) .setSource(source) .setPartitions(partitions) .setHoldoutFraction(holdout); cross.setProject(project); addDataset(cross); return this; }