Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/19208#discussion_r148885817
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/tuning/CrossValidator.scala ---
@@ -282,12 +328,40 @@ object CrossValidatorModel extends
MLReadable[CrossValidatorModel] {
ValidatorParams.validateParams(instance)
+ protected var shouldPersistSubModels: Boolean = if
(instance.hasSubModels) true else false
+
+ /**
+ * Extra options for CrossValidatorModelWriter, current support
"persistSubModels".
+ * if sub models exsit, the default value for option
"persistSubModels" is "true".
+ */
+ @Since("2.3.0")
+ override def option(key: String, value: String): this.type = {
+ key.toLowerCase(Locale.ROOT) match {
+ case "persistsubmodels" => shouldPersistSubModels = value.toBoolean
+ case _ => throw new IllegalArgumentException(
+ s"Illegal option ${key} for CrossValidatorModelWriter")
+ }
+ this
+ }
+
override protected def saveImpl(path: String): Unit = {
import org.json4s.JsonDSL._
- val extraMetadata = "avgMetrics" -> instance.avgMetrics.toSeq
+ val extraMetadata = ("avgMetrics" -> instance.avgMetrics.toSeq) ~
+ ("shouldPersistSubModels" -> shouldPersistSubModels)
--- End diff --
Let's have 1 name for this argument: "persistSubModels"
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]