{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/43720929","id":43720929,"diff_hunk":"@@ -690,6 +690,21 @@ class LDAModel(JavaModelWrapper):\n     >>> model = LDA.train(rdd, k=2)\n     >>> model.vocabSize()\n     2\n+    >>> topics = model.describeTopics()\n+    >>> len(topics)\n+    2\n+    >>> len(list(topics[0])[0])\n+    2\n+    >>> len(list(topics[0])[1])\n+    2\n+    >>> topics = model.describeTopics(1)","path":"python/pyspark/mllib/clustering.py","position":20,"original_position":20,"commit_id":"0bc114e9fe8f61745436a1a1d49a8dac41e6db26","original_commit_id":"0bc114e9fe8f61745436a1a1d49a8dac41e6db26","user":{"login":"davies","id":40902,"avatar_url":"https://avatars.githubusercontent.com/u/40902?v=3","gravatar_id":"","url":"https://api.github.com/users/davies","html_url":"https://github.com/davies","followers_url":"https://api.github.com/users/davies/followers","following_url":"https://api.github.com/users/davies/following{/other_user}","gists_url":"https://api.github.com/users/davies/gists{/gist_id}","starred_url":"https://api.github.com/users/davies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davies/subscriptions","organizations_url":"https://api.github.com/users/davies/orgs","repos_url":"https://api.github.com/users/davies/repos","events_url":"https://api.github.com/users/davies/events{/privacy}","received_events_url":"https://api.github.com/users/davies/received_events","type":"User","site_admin":false},"body":"One test case should be enough.\r\n\r\nThese test will become example in docs, so it's better to be more readable, for example:\r\n```\r\n>>> list(sorted(model.describeTopics()))\r\n[([0, 1], [0.50..., 0.49...]), ([1, 0], [0.50..., 0.49...])]\r\n```","created_at":"2015-11-03T07:09:45Z","updated_at":"2015-11-03T07:09:45Z","html_url":"https://github.com/apache/spark/pull/8643#discussion_r43720929","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/8643","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/43720929"},"html":{"href":"https://github.com/apache/spark/pull/8643#discussion_r43720929"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/8643"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/8643","id":44357191,"html_url":"https://github.com/apache/spark/pull/8643","diff_url":"https://github.com/apache/spark/pull/8643.diff","patch_url":"https://github.com/apache/spark/pull/8643.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/8643","number":8643,"state":"open","locked":false,"title":"[SPARK-8467][MLlib][PySpark] Add LDAModel.describeTopics() in Python","user":{"login":"yu-iskw","id":1523515,"avatar_url":"https://avatars.githubusercontent.com/u/1523515?v=3","gravatar_id":"","url":"https://api.github.com/users/yu-iskw","html_url":"https://github.com/yu-iskw","followers_url":"https://api.github.com/users/yu-iskw/followers","following_url":"https://api.github.com/users/yu-iskw/following{/other_user}","gists_url":"https://api.github.com/users/yu-iskw/gists{/gist_id}","starred_url":"https://api.github.com/users/yu-iskw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yu-iskw/subscriptions","organizations_url":"https://api.github.com/users/yu-iskw/orgs","repos_url":"https://api.github.com/users/yu-iskw/repos","events_url":"https://api.github.com/users/yu-iskw/events{/privacy}","received_events_url":"https://api.github.com/users/yu-iskw/received_events","type":"User","site_admin":false},"body":"Could @jkbradley and @davies review it?\r\n\r\n- Create a wrapper class: `LDAModelWrapper` for `LDAModel`. Because we can't deal with the return value of`describeTopics` in Scala from pyspark directly. `Array[(Array[Int], Array[Double])]` is too complicated to convert it.\r\n- Add `loadLDAModel` in `PythonMLlibAPI`. Since `LDAModel` in Scala is an abstract class and we need to call `load` of `DistributedLDAModel`.\r\n\r\n[[SPARK-8467] Add LDAModel.describeTopics() in Python - ASF JIRA](https://issues.apache.org/jira/browse/SPARK-8467)","created_at":"2015-09-07T13:50:47Z","updated_at":"2015-11-03T07:09:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"23de551a811c258ec624f3fc9b35a063f0ca8a70","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/8643/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/8643/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/8643/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/0bc114e9fe8f61745436a1a1d49a8dac41e6db26","head":{"label":"yu-iskw:SPARK-8467-2","ref":"SPARK-8467-2","sha":"0bc114e9fe8f61745436a1a1d49a8dac41e6db26","user":{"login":"yu-iskw","id":1523515,"avatar_url":"https://avatars.githubusercontent.com/u/1523515?v=3","gravatar_id":"","url":"https://api.github.com/users/yu-iskw","html_url":"https://github.com/yu-iskw","followers_url":"https://api.github.com/users/yu-iskw/followers","following_url":"https://api.github.com/users/yu-iskw/following{/other_user}","gists_url":"https://api.github.com/users/yu-iskw/gists{/gist_id}","starred_url":"https://api.github.com/users/yu-iskw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yu-iskw/subscriptions","organizations_url":"https://api.github.com/users/yu-iskw/orgs","repos_url":"https://api.github.com/users/yu-iskw/repos","events_url":"https://api.github.com/users/yu-iskw/events{/privacy}","received_events_url":"https://api.github.com/users/yu-iskw/received_events","type":"User","site_admin":false},"repo":{"id":20396045,"name":"spark","full_name":"yu-iskw/spark","owner":{"login":"yu-iskw","id":1523515,"avatar_url":"https://avatars.githubusercontent.com/u/1523515?v=3","gravatar_id":"","url":"https://api.github.com/users/yu-iskw","html_url":"https://github.com/yu-iskw","followers_url":"https://api.github.com/users/yu-iskw/followers","following_url":"https://api.github.com/users/yu-iskw/following{/other_user}","gists_url":"https://api.github.com/users/yu-iskw/gists{/gist_id}","starred_url":"https://api.github.com/users/yu-iskw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yu-iskw/subscriptions","organizations_url":"https://api.github.com/users/yu-iskw/orgs","repos_url":"https://api.github.com/users/yu-iskw/repos","events_url":"https://api.github.com/users/yu-iskw/events{/privacy}","received_events_url":"https://api.github.com/users/yu-iskw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yu-iskw/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/yu-iskw/spark","forks_url":"https://api.github.com/repos/yu-iskw/spark/forks","keys_url":"https://api.github.com/repos/yu-iskw/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yu-iskw/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yu-iskw/spark/teams","hooks_url":"https://api.github.com/repos/yu-iskw/spark/hooks","issue_events_url":"https://api.github.com/repos/yu-iskw/spark/issues/events{/number}","events_url":"https://api.github.com/repos/yu-iskw/spark/events","assignees_url":"https://api.github.com/repos/yu-iskw/spark/assignees{/user}","branches_url":"https://api.github.com/repos/yu-iskw/spark/branches{/branch}","tags_url":"https://api.github.com/repos/yu-iskw/spark/tags","blobs_url":"https://api.github.com/repos/yu-iskw/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yu-iskw/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yu-iskw/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/yu-iskw/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yu-iskw/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/yu-iskw/spark/languages","stargazers_url":"https://api.github.com/repos/yu-iskw/spark/stargazers","contributors_url":"https://api.github.com/repos/yu-iskw/spark/contributors","subscribers_url":"https://api.github.com/repos/yu-iskw/spark/subscribers","subscription_url":"https://api.github.com/repos/yu-iskw/spark/subscription","commits_url":"https://api.github.com/repos/yu-iskw/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/yu-iskw/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/yu-iskw/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/yu-iskw/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/yu-iskw/spark/contents/{+path}","compare_url":"https://api.github.com/repos/yu-iskw/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yu-iskw/spark/merges","archive_url":"https://api.github.com/repos/yu-iskw/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yu-iskw/spark/downloads","issues_url":"https://api.github.com/repos/yu-iskw/spark/issues{/number}","pulls_url":"https://api.github.com/repos/yu-iskw/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/yu-iskw/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/yu-iskw/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yu-iskw/spark/labels{/name}","releases_url":"https://api.github.com/repos/yu-iskw/spark/releases{/id}","created_at":"2014-06-02T07:24:57Z","updated_at":"2014-07-25T08:42:00Z","pushed_at":"2015-11-03T04:43:48Z","git_url":"git://github.com/yu-iskw/spark.git","ssh_url":"git@github.com:yu-iskw/spark.git","clone_url":"https://github.com/yu-iskw/spark.git","svn_url":"https://github.com/yu-iskw/spark","homepage":null,"size":122528,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"efaa4721b511a1d29229facde6457a6dcda18966","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}","created_at":"2014-02-25T08:00:08Z","updated_at":"2015-11-03T06:41:48Z","pushed_at":"2015-11-03T07:07:18Z","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":1650578,"stargazers_count":5988,"watchers_count":5988,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5580,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":375,"forks":5580,"open_issues":375,"watchers":5988,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/8643"},"html":{"href":"https://github.com/apache/spark/pull/8643"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/8643"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/8643/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/8643/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/8643/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/0bc114e9fe8f61745436a1a1d49a8dac41e6db26"}}}}