Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4595#discussion_r24689713
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/tuning/CrossValidator.scala ---
    @@ -77,10 +77,12 @@ class CrossValidator extends 
Estimator[CrossValidatorModel] with CrossValidatorP
         val splits = MLUtils.kFold(dataset.rdd, map(numFolds), 0)
         splits.zipWithIndex.foreach { case ((training, validation), 
splitIndex) =>
           val trainingDataset = sqlCtx.createDataFrame(training, 
schema).cache()
    -      val validationDataset = sqlCtx.createDataFrame(validation, 
schema).cache()
    +      val validationDataset = sqlCtx.createDataFrame(validation, schema)
           // multi-model training
           logDebug(s"Train split $splitIndex with multiple sets of 
parameters.")
           val models = est.fit(trainingDataset, 
epm).asInstanceOf[Seq[Model[_]]]
    +      trainingDataset.unpersist()
    +      validationDataset.cache()
    --- End diff --
    
    Seems reasonable to me, except that moving the `cache()` call here doesn't 
do anything. It won't be materialized until it's accessed anyway. So this 
reduces to making sure to properly unpersist the RDDs.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to