{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/80833730","pull_request_review_id":1859950,"id":80833730,"diff_hunk":"@@ -300,15 +301,23 @@ private[ml] object DefaultParamsWriter {\n       paramMap: Option[JValue] = None): String = {\n     val uid = instance.uid\n     val cls = instance.getClass.getName\n-    val params = instance.extractParamMap().toSeq.asInstanceOf[Seq[ParamPair[Any]]]\n+    val params = instance.extractParamMap().toSeq\n+      .filter(_.param.name != \"initialModel\").asInstanceOf[Seq[ParamPair[Any]]]\n     val jsonParams = paramMap.getOrElse(render(params.map { case ParamPair(p, v) =>\n       p.name -> parse(p.jsonEncode(v))\n     }.toList))\n+    // If the instance has an \"initialModel\" param and the param is defined, then the initial model\n+    // will be saved along with the instance.\n+    val initialModelFlag =\n+      instance.hasParam(\"initialModel\") && instance.isDefined(instance.getParam(\"initialModel\"))\n     val basicMetadata = (\"class\" -> cls) ~\n       (\"timestamp\" -> System.currentTimeMillis()) ~\n       (\"sparkVersion\" -> sc.version) ~\n       (\"uid\" -> uid) ~\n-      (\"paramMap\" -> jsonParams)\n+      (\"paramMap\" -> jsonParams) ~\n+      // TODO: Figure out more robust way to detect the existing of the initialModel.","path":"mllib/src/main/scala/org/apache/spark/ml/util/ReadWrite.scala","position":28,"original_position":28,"commit_id":"92cf83dae222a4e7cce0d201c81a26d70f51b161","original_commit_id":"92cf83dae222a4e7cce0d201c81a26d70f51b161","user":{"login":"sethah","id":7275795,"avatar_url":"https://avatars.githubusercontent.com/u/7275795?v=3","gravatar_id":"","url":"https://api.github.com/users/sethah","html_url":"https://github.com/sethah","followers_url":"https://api.github.com/users/sethah/followers","following_url":"https://api.github.com/users/sethah/following{/other_user}","gists_url":"https://api.github.com/users/sethah/gists{/gist_id}","starred_url":"https://api.github.com/users/sethah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethah/subscriptions","organizations_url":"https://api.github.com/users/sethah/orgs","repos_url":"https://api.github.com/users/sethah/repos","events_url":"https://api.github.com/users/sethah/events{/privacy}","received_events_url":"https://api.github.com/users/sethah/received_events","type":"User","site_admin":false},"body":"If we're going to leave it as a TODO, let's have a Jira for it.","created_at":"2016-09-28T02:28:04Z","updated_at":"2016-09-28T02:28:04Z","html_url":"https://github.com/apache/spark/pull/11119#discussion_r80833730","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/11119","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/80833730"},"html":{"href":"https://github.com/apache/spark/pull/11119#discussion_r80833730"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/11119"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/11119","id":58661049,"html_url":"https://github.com/apache/spark/pull/11119","diff_url":"https://github.com/apache/spark/pull/11119.diff","patch_url":"https://github.com/apache/spark/pull/11119.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/11119","number":11119,"state":"open","locked":false,"title":"[SPARK-10780][ML] Add an initial model to kmeans","user":{"login":"yinxusen","id":2637239,"avatar_url":"https://avatars.githubusercontent.com/u/2637239?v=3","gravatar_id":"","url":"https://api.github.com/users/yinxusen","html_url":"https://github.com/yinxusen","followers_url":"https://api.github.com/users/yinxusen/followers","following_url":"https://api.github.com/users/yinxusen/following{/other_user}","gists_url":"https://api.github.com/users/yinxusen/gists{/gist_id}","starred_url":"https://api.github.com/users/yinxusen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yinxusen/subscriptions","organizations_url":"https://api.github.com/users/yinxusen/orgs","repos_url":"https://api.github.com/users/yinxusen/repos","events_url":"https://api.github.com/users/yinxusen/events{/privacy}","received_events_url":"https://api.github.com/users/yinxusen/received_events","type":"User","site_admin":false},"body":"https://issues.apache.org/jira/browse/SPARK-10780\r\n\r\nI mark it as WIP because there are several issues need to discuss:\r\n\r\n1. Codegen for shared params doesn't support general type. But IMHO there is no need to rewrite the codegen to support general type params, for now. So I add an `extras` in `SharedParamsCodeGen` to support this kind of exception. We may modify the codegen later if there are more general type shared parameters.\r\n\r\n2. Since we add `Model` in parameters of every `Estimator`, the save/load of estimators should be modified to support model persistence, refer to https://github.com/apache/spark/pull/9971. I ignore it in this version of the code because the save/load works well only if we don't set `initialModel`. I'll add save/load for the new parameter after the discussion.\r\n\r\n3. I don't add model check (e.g. number of centers equals to k, the dimension of centers equals to data points') here because the inner `MLlibKMeans` checks it for us. For those estimators whose MLlib companions don't provide warm-starts, we need to check the initial model in ML package.\r\n\r\n4. I add three different setters for `KMeans`. The first one uses for collaboration with model save/load, the second one is for accepting generalized model, and the third one is more user-friendly.","created_at":"2016-02-08T20:16:46Z","updated_at":"2016-09-28T02:28:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0e824a9e1ee4a3c034ddff5c50e18862232dac70","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/11119/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/11119/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/11119/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/92cf83dae222a4e7cce0d201c81a26d70f51b161","head":{"label":"yinxusen:SPARK-10780","ref":"SPARK-10780","sha":"92cf83dae222a4e7cce0d201c81a26d70f51b161","user":{"login":"yinxusen","id":2637239,"avatar_url":"https://avatars.githubusercontent.com/u/2637239?v=3","gravatar_id":"","url":"https://api.github.com/users/yinxusen","html_url":"https://github.com/yinxusen","followers_url":"https://api.github.com/users/yinxusen/followers","following_url":"https://api.github.com/users/yinxusen/following{/other_user}","gists_url":"https://api.github.com/users/yinxusen/gists{/gist_id}","starred_url":"https://api.github.com/users/yinxusen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yinxusen/subscriptions","organizations_url":"https://api.github.com/users/yinxusen/orgs","repos_url":"https://api.github.com/users/yinxusen/repos","events_url":"https://api.github.com/users/yinxusen/events{/privacy}","received_events_url":"https://api.github.com/users/yinxusen/received_events","type":"User","site_admin":false},"repo":{"id":17233732,"name":"spark","full_name":"yinxusen/spark","owner":{"login":"yinxusen","id":2637239,"avatar_url":"https://avatars.githubusercontent.com/u/2637239?v=3","gravatar_id":"","url":"https://api.github.com/users/yinxusen","html_url":"https://github.com/yinxusen","followers_url":"https://api.github.com/users/yinxusen/followers","following_url":"https://api.github.com/users/yinxusen/following{/other_user}","gists_url":"https://api.github.com/users/yinxusen/gists{/gist_id}","starred_url":"https://api.github.com/users/yinxusen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yinxusen/subscriptions","organizations_url":"https://api.github.com/users/yinxusen/orgs","repos_url":"https://api.github.com/users/yinxusen/repos","events_url":"https://api.github.com/users/yinxusen/events{/privacy}","received_events_url":"https://api.github.com/users/yinxusen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yinxusen/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/yinxusen/spark","forks_url":"https://api.github.com/repos/yinxusen/spark/forks","keys_url":"https://api.github.com/repos/yinxusen/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yinxusen/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yinxusen/spark/teams","hooks_url":"https://api.github.com/repos/yinxusen/spark/hooks","issue_events_url":"https://api.github.com/repos/yinxusen/spark/issues/events{/number}","events_url":"https://api.github.com/repos/yinxusen/spark/events","assignees_url":"https://api.github.com/repos/yinxusen/spark/assignees{/user}","branches_url":"https://api.github.com/repos/yinxusen/spark/branches{/branch}","tags_url":"https://api.github.com/repos/yinxusen/spark/tags","blobs_url":"https://api.github.com/repos/yinxusen/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yinxusen/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yinxusen/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/yinxusen/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yinxusen/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/yinxusen/spark/languages","stargazers_url":"https://api.github.com/repos/yinxusen/spark/stargazers","contributors_url":"https://api.github.com/repos/yinxusen/spark/contributors","subscribers_url":"https://api.github.com/repos/yinxusen/spark/subscribers","subscription_url":"https://api.github.com/repos/yinxusen/spark/subscription","commits_url":"https://api.github.com/repos/yinxusen/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/yinxusen/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/yinxusen/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/yinxusen/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/yinxusen/spark/contents/{+path}","compare_url":"https://api.github.com/repos/yinxusen/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yinxusen/spark/merges","archive_url":"https://api.github.com/repos/yinxusen/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yinxusen/spark/downloads","issues_url":"https://api.github.com/repos/yinxusen/spark/issues{/number}","pulls_url":"https://api.github.com/repos/yinxusen/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/yinxusen/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/yinxusen/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yinxusen/spark/labels{/name}","releases_url":"https://api.github.com/repos/yinxusen/spark/releases{/id}","deployments_url":"https://api.github.com/repos/yinxusen/spark/deployments","created_at":"2014-02-27T02:30:58Z","updated_at":"2015-12-19T01:15:28Z","pushed_at":"2016-09-27T06:58:30Z","git_url":"git://github.com/yinxusen/spark.git","ssh_url":"git@github.com:yinxusen/spark.git","clone_url":"https://github.com/yinxusen/spark.git","svn_url":"https://github.com/yinxusen/spark","homepage":null,"size":172200,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"095862a3cff73fd88db9ed37a63e7629e664ff64","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","deployments_url":"https://api.github.com/repos/apache/spark/deployments","created_at":"2014-02-25T08:00:08Z","updated_at":"2016-09-28T01:59:07Z","pushed_at":"2016-09-28T02:22:10Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":523193,"stargazers_count":10177,"watchers_count":10177,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9473,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":480,"forks":9473,"open_issues":480,"watchers":10177,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/11119"},"html":{"href":"https://github.com/apache/spark/pull/11119"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/11119"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/11119/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/11119/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/11119/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/92cf83dae222a4e7cce0d201c81a26d70f51b161"}}}}
{"actor":{"display_login":"sethah"}}