Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/11119#discussion_r81263907
--- Diff: mllib/src/main/scala/org/apache/spark/ml/util/ReadWrite.scala ---
@@ -300,15 +301,23 @@ private[ml] object DefaultParamsWriter {
paramMap: Option[JValue] = None): String = {
val uid = instance.uid
val cls = instance.getClass.getName
- val params =
instance.extractParamMap().toSeq.asInstanceOf[Seq[ParamPair[Any]]]
+ val params = instance.extractParamMap().toSeq
+ .filter(_.param.name !=
"initialModel").asInstanceOf[Seq[ParamPair[Any]]]
val jsonParams = paramMap.getOrElse(render(params.map { case
ParamPair(p, v) =>
p.name -> parse(p.jsonEncode(v))
}.toList))
+ // If the instance has an "initialModel" param and the param is
defined, then the initial model
+ // will be saved along with the instance.
+ val initialModelFlag =
+ instance.hasParam("initialModel") &&
instance.isDefined(instance.getParam("initialModel"))
val basicMetadata = ("class" -> cls) ~
("timestamp" -> System.currentTimeMillis()) ~
("sparkVersion" -> sc.version) ~
("uid" -> uid) ~
- ("paramMap" -> jsonParams)
+ ("paramMap" -> jsonParams) ~
+ // TODO: Figure out more robust way to detect the existing of the
initialModel.
--- End diff --
Hmm, the comment seems to have been placed in the wrong spot. I meant that
in the test suite, there is a test called "Initialize using given cluster
centers" when we are really initializing it by training a model and using it as
the initial model. Sorry for the confusion.
---
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]