GridSearchTVSplit extends BaseGridSearch <GridSearchTVSplit, GridSearchTVSplitModel> implements HasTrainRatio <GridSearchTVSplit> { @Override protected Tuple2<Pipeline, Report> findBest(BatchOperator in, PipelineCandidatesGrid candidates) { return findBestTVSplit(in, getTrainRatio(), candidates); } GridSearchTVSplit();   }
@Test public void findBest() { GbdtClassifier gbdtClassifier = new GbdtClassifier() .setFeatureCols(colNames[0], colNames[1]) .setLabelCol(colNames[2]) .setMinSamplesPerLeaf(1) .setPredictionCol("pred") .setPredictionDetailCol("pred_detail"); ParamGrid grid = new ParamGrid() .addGrid(gbdtClassifier, GbdtClassifier.NUM_TREES, new Integer[]{1, 2}); GridSearchTVSplit gridSearchTVSplit = new GridSearchTVSplit() .setEstimator(gbdtClassifier) .setParamGrid(grid) .setTrainRatio(0.5) .setTuningEvaluator( new BinaryClassificationTuningEvaluator() .setTuningBinaryClassMetric(TuningBinaryClassMetric.ACCURACY) .setLabelCol(colNames[2]) .setPositiveLabelValueString("1") .setPredictionDetailCol("pred_detail") ); GridSearchTVSplitModel model = gridSearchTVSplit.fit(memSourceBatchOp); Assert.assertEquals( testArray.length, model.transform(memSourceBatchOp).collect().size() ); }