Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 32CD3200B9B for ; Wed, 28 Sep 2016 04:28:37 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 31316160AE5; Wed, 28 Sep 2016 02:28:37 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7A026160AD2 for ; Wed, 28 Sep 2016 04:28:36 +0200 (CEST) Received: (qmail 12164 invoked by uid 500); 28 Sep 2016 02:28:35 -0000 Mailing-List: contact reviews-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list reviews@spark.apache.org Received: (qmail 12139 invoked by uid 99); 28 Sep 2016 02:28:35 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2016 02:28:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 19DF2DFF56; Wed, 28 Sep 2016 02:28:35 +0000 (UTC) From: sethah To: reviews@spark.apache.org Reply-To: reviews@spark.apache.org References: In-Reply-To: Subject: [GitHub] spark pull request #11119: [SPARK-10780][ML] Add an initial model to kmeans Content-Type: text/plain Message-Id: <20160928022835.19DF2DFF56@git1-us-west.apache.org> Date: Wed, 28 Sep 2016 02:28:35 +0000 (UTC) archived-at: Wed, 28 Sep 2016 02:28:37 -0000 Github user sethah commented on a diff in the pull request: https://github.com/apache/spark/pull/11119#discussion_r80833730 --- 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 -- If we're going to leave it as a TODO, let's have a Jira for it. --- 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 infrastructure@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org For additional commands, e-mail: reviews-help@spark.apache.org