【问题标题】:Is there a way to output all the cross validation models results in spark scala有没有办法在 spark scala 中输出所有交叉验证模型的结果
【发布时间】:2018-09-24 21:53:46
【问题描述】:

我在 Spark 中使用交叉验证来选择模型和参数。由于应用需要,我不仅需要知道最佳模型,还需要知道所有模型的结果。 当我使用 python sklearn 时,我可以使用

clf = GridSearchCV()
clf.cv_results_ 

打印出所有模型,如下所示: 开发集的网格分数:

0.986 (+/-0.016) for {'C': 1, 'gamma': 0.001, 'kernel': 'rbf'}
0.959 (+/-0.029) for {'C': 1, 'gamma': 0.0001, 'kernel': 'rbf'}
0.988 (+/-0.017) for {'C': 10, 'gamma': 0.001, 'kernel': 'rbf'}
0.982 (+/-0.026) for {'C': 10, 'gamma': 0.0001, 'kernel': 'rbf'}
0.988 (+/-0.017) for {'C': 100, 'gamma': 0.001, 'kernel': 'rbf'}
0.982 (+/-0.025) for {'C': 100, 'gamma': 0.0001, 'kernel': 'rbf'}
0.988 (+/-0.017) for {'C': 1000, 'gamma': 0.001, 'kernel': 'rbf'}
0.982 (+/-0.025) for {'C': 1000, 'gamma': 0.0001, 'kernel': 'rbf'}
0.975 (+/-0.014) for {'C': 1, 'kernel': 'linear'}
0.975 (+/-0.014) for {'C': 10, 'kernel': 'linear'}
0.975 (+/-0.014) for {'C': 100, 'kernel': 'linear'}
0.975 (+/-0.014) for {'C': 1000, 'kernel': 'linear'}

我有火花

val cv = new CrossValidator()
  .setEstimator(pipeline)
  .setEvaluator(new MulticlassClassificationEvaluator)
  .setEstimatorParamMaps(paramLRGrid)
  .setNumFolds(3)
val cvModel = cv.fit(trainingData)

我想知道在 spark 中是否有类似 clf.cv_results_ 的方法可以看到所有模型

【问题讨论】:

    标签: scala apache-spark cross-validation


    【解决方案1】:

    这应该会有所帮助:

    cvModel.subModels
    

    如此处所述: Spark CrossValidatorModel access other models than the bestModel?

    【讨论】:

      猜你喜欢
      • 2017-06-20
      • 2019-04-05
      • 1970-01-01
      • 1970-01-01
      • 2018-05-21
      • 2019-10-29
      • 2020-05-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多