【发布时间】:2019-05-15 14:31:31
【问题描述】:
我在这个网站上找到了下面的代码: https://spark.apache.org/docs/2.3.1/ml-tuning.html
// Note that the evaluator here is a BinaryClassificationEvaluator and its default metric
// is areaUnderROC.
val cv = new CrossValidator()
.setEstimator(pipeline)
.setEvaluator(new BinaryClassificationEvaluator)
.setEstimatorParamMaps(paramGrid)
.setNumFolds(2) // Use 3+ in practice
.setParallelism(2) // Evaluate up to 2 parameter settings in parallel
正如他们所说,BinaryClassificationEvaluator 的默认指标是“AUC”。 如何将此默认指标更改为 F1 分数?
我试过了:
// Note that the evaluator here is a BinaryClassificationEvaluator and its default metric
// is areaUnderROC.
val cv = new CrossValidator()
.setEstimator(pipeline)
.setEvaluator(new BinaryClassificationEvaluator.setMetricName("f1"))
.setEstimatorParamMaps(paramGrid)
.setNumFolds(2) // Use 3+ in practice
.setParallelism(2) // Evaluate up to 2 parameter settings in parallel
但是我遇到了一些错误... 我搜索了很多网站,但我没有找到解决方案...
【问题讨论】:
标签: scala apache-spark cross-validation metrics evaluator