Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/11119#discussion_r77040324
--- Diff: mllib/src/main/scala/org/apache/spark/ml/util/ReadWrite.scala ---
@@ -318,6 +324,17 @@ private[ml] object DefaultParamsWriter {
val metadataJson: String = compact(render(metadata))
metadataJson
}
+
+ def saveInitialModel(instance: Params, path: String): Unit = {
--- End diff --
Perhaps the following is more typesafe:
````scala
def saveInitialModel[T <: HasInitialModel[_]](instance: T, path: String):
Unit = {
if (instance.isDefined(instance.initialModel)) {
instance.getInitialModel match {
case writable: MLWritable =>
val initialModelPath = new Path(path, "initialModel").toString
writable.save(initialModelPath)
case _ => throw new IllegalArgumentException("encountered initial
model that " +
"isn't writable.")
}
}
}
````
---
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]