GridSearchCV extends BaseGridSearch<GridSearchCV, GridSearchCVModel> implements HasNumFolds<GridSearchCV> { @Override protected Tuple2<Pipeline, Report> findBest(BatchOperator in, PipelineCandidatesGrid candidates) { return findBestCV(in, getNumFolds(), candidates); } GridSearchCV();   }
@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}) .addGrid(gbdtClassifier, GbdtClassifier.MAX_DEPTH, new Integer[]{3}); GridSearchCV gridSearchCV = new GridSearchCV() .setEstimator(gbdtClassifier) .setParamGrid(grid) .setNumFolds(2) .enableLazyPrintTrainInfo() .setTuningEvaluator( new BinaryClassificationTuningEvaluator() .setTuningBinaryClassMetric(TuningBinaryClassMetric.ACCURACY) .setLabelCol(colNames[2]) .setPositiveLabelValueString("1") .setPredictionDetailCol("pred_detail") ); GridSearchCVModel model = gridSearchCV.fit(memSourceBatchOp); Assert.assertEquals( testArray.length, model.transform(memSourceBatchOp).collect().size() ); }