CrossValidator 

  • CrossValidator is an Estimator for model tuning, i.e. finding the best model for given parameters and a dataset.
  • CrossValidator splits the dataset into a set of non-overlapping randomly-partitioned numFolds pairs of training and validation datasets.
  • CrossValidator generates a CrossValidatorModel to hold the best model and average cross-validation metrics.
   val paramGrid = new ParamGridBuilder()
      .addGrid(rf.impurity, Array("entropy", "gini"))
      .build()

    val cv = new CrossValidator()
      .setEstimator(pipeline)
      .setEvaluator(evaluator)
      .setEstimatorParamMaps(paramGrid)
      .setNumFolds(3)

    val model = cv.fit(training)

    val predictions = model.transform(test)
    predictions.show()

results matching ""

    No results matching ""