GitHub PullRequestReviewCommentEvent at 2014-11-18 01:20:13
Repository: spark
Actor: manishamde
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/20479768","id":20479768,"diff_hunk":"@@ -181,8 +180,191 @@ def trainRegressor(data, categoricalFeaturesInfo,\n         >>> model.predict(rdd).collect()\n         [1.0, 0.0]\n         \"\"\"\n-        return DecisionTree._train(data, \"regression\", 0, categoricalFeaturesInfo,\n-                                   impurity, maxDepth, maxBins, minInstancesPerNode, minInfoGain)\n+        return cls._train(data, \"regression\", 0, categoricalFeaturesInfo,\n+                          impurity, maxDepth, maxBins, minInstancesPerNode, minInfoGain)\n+\n+\n+class WeightedEnsembleModel(JavaModelWrapper):","path":"python/pyspark/mllib/tree.py","position":107,"original_position":107,"commit_id":"89a000fd8e6e15c2ba83d702bbe2f294727f0a4d","original_commit_id":"89a000fd8e6e15c2ba83d702bbe2f294727f0a4d","user":{"login":"manishamde","id":1067223,"avatar_url":"https://avatars.githubusercontent.com/u/1067223?v=3","gravatar_id":"","url":"https://api.github.com/users/manishamde","html_url":"https://github.com/manishamde","followers_url":"https://api.github.com/users/manishamde/followers","following_url":"https://api.github.com/users/manishamde/following{/other_user}","gists_url":"https://api.github.com/users/manishamde/gists{/gist_id}","starred_url":"https://api.github.com/users/manishamde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manishamde/subscriptions","organizations_url":"https://api.github.com/users/manishamde/orgs","repos_url":"https://api.github.com/users/manishamde/repos","events_url":"https://api.github.com/users/manishamde/events{/privacy}","received_events_url":"https://api.github.com/users/manishamde/received_events","type":"User","site_admin":false},"body":"@mengxr The idea was that ```WeightedEnsembleModel``` model will also support non-tree based weak learners for boosting. I don't have a strong preference either way. \r\n\r\nMay be we could also removed the prefix ```Weighted``` from the ```WeightedEnsembleModel``` to keep the name simple.","created_at":"2014-11-18T01:20:13Z","updated_at":"2014-11-18T01:20:13Z","html_url":"https://github.com/apache/spark/pull/3320#discussion_r20479768","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/3320","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/20479768"},"html":{"href":"https://github.com/apache/spark/pull/3320#discussion_r20479768"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/3320"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/3320","id":24559673,"html_url":"https://github.com/apache/spark/pull/3320","diff_url":"https://github.com/apache/spark/pull/3320.diff","patch_url":"https://github.com/apache/spark/pull/3320.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/3320","number":3320,"state":"open","locked":false,"title":"[SPARK-4439] [MLlib] add python api for random forest","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":"```\r\n    class WeightedEnsembleModel\r\n     |  A model trained by RandomForest\r\n     |\r\n     |  numWeakHypotheses(self)\r\n     |      Get number of trees in forest.\r\n     |\r\n     |  predict(self, x)\r\n     |      Predict values for a single data point or an RDD of points using the model trained.\r\n     |\r\n     |  toDebugString(self)\r\n     |      Full model\r\n     |\r\n     |  totalNumNodes(self)\r\n     |      Get total number of nodes, summed over all trees in the forest.\r\n     |\r\n\r\n    class RandomForest\r\n     |  trainClassifier(cls, data, numClassesForClassification, categoricalFeaturesInfo, numTrees, featureSubsetStrategy='auto', impurity='gini', maxDepth=4, maxBins=32, seed=None):\r\n     |      Method to train a decision tree model for binary or multiclass classification.\r\n     |\r\n     |      :param data: Training dataset: RDD of LabeledPoint.\r\n     |                   Labels should take values {0, 1, ..., numClasses-1}.\r\n     |      :param numClassesForClassification: number of classes for classification.\r\n     |      :param categoricalFeaturesInfo: Map storing arity of categorical features.\r\n     |                                  E.g., an entry (n -> k) indicates that feature n is categorical\r\n     |                                  with k categories indexed from 0: {0, 1, ..., k-1}.\r\n     |      :param numTrees: Number of trees in the random forest.\r\n     |      :param featureSubsetStrategy: Number of features to consider for splits at each node.\r\n     |                                Supported: \"auto\" (default), \"all\", \"sqrt\", \"log2\", \"onethird\".\r\n     |                                If \"auto\" is set, this parameter is set based on numTrees:\r\n     |                                  if numTrees == 1, set to \"all\";\r\n     |                                  if numTrees > 1 (forest) set to \"sqrt\" for classification and\r\n     |                                    to \"onethird\" for regression.\r\n     |      :param impurity: Criterion used for information gain calculation.\r\n     |                   Supported values: \"gini\" (recommended) or \"entropy\".\r\n     |      :param maxDepth: Maximum depth of the tree. E.g., depth 0 means 1 leaf node; depth 1 means\r\n     |                       1 internal node + 2 leaf nodes. (default: 4)\r\n     |      :param maxBins: maximum number of bins used for splitting features (default: 100)\r\n     |      :param seed:  Random seed for bootstrapping and choosing feature subsets.\r\n     |      :return: WeightedEnsembleModel that can be used for prediction\r\n     |\r\n     |   trainRegressor(cls, data, categoricalFeaturesInfo, numTrees, featureSubsetStrategy='auto', impurity='variance', maxDepth=4, maxBins=32, seed=None):\r\n     |      Method to train a decision tree model for regression.\r\n     |\r\n     |      :param data: Training dataset: RDD of LabeledPoint.\r\n     |                   Labels are real numbers.\r\n     |      :param categoricalFeaturesInfo: Map storing arity of categorical features.\r\n     |                                   E.g., an entry (n -> k) indicates that feature n is categorical\r\n     |                                   with k categories indexed from 0: {0, 1, ..., k-1}.\r\n     |      :param numTrees: Number of trees in the random forest.\r\n     |      :param featureSubsetStrategy: Number of features to consider for splits at each node.\r\n     |                                 Supported: \"auto\" (default), \"all\", \"sqrt\", \"log2\", \"onethird\".\r\n     |                                 If \"auto\" is set, this parameter is set based on numTrees:\r\n     |                                 if numTrees == 1, set to \"all\";\r\n     |                                 if numTrees > 1 (forest) set to \"sqrt\" for classification and\r\n     |                                 to \"onethird\" for regression.\r\n     |      :param impurity: Criterion used for information gain calculation.\r\n     |                       Supported values: \"variance\".\r\n     |      :param maxDepth: Maximum depth of the tree. E.g., depth 0 means 1 leaf node; depth 1 means\r\n     |                       1 internal node + 2 leaf nodes.(default: 4)\r\n     |      :param maxBins: maximum number of bins used for splitting features (default: 100)\r\n     |      :param seed:  Random seed for bootstrapping and choosing feature subsets.\r\n     |      :return: WeightedEnsembleModel that can be used for prediction\r\n     |\r\n```","created_at":"2014-11-17T19:22:55Z","updated_at":"2014-11-18T01:20:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3886f138ccbe1dfbf1726f3b7c87e875406b9858","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/3320/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/3320/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments/{number}","comments_url":"https://api.github.com/repos/apache/spark/issues/3320/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/89a000fd8e6e15c2ba83d702bbe2f294727f0a4d","head":{"label":"davies:forest","ref":"forest","sha":"89a000fd8e6e15c2ba83d702bbe2f294727f0a4d","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},"repo":{"id":21724875,"name":"spark","full_name":"davies/spark","owner":{"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},"private":false,"html_url":"https://github.com/davies/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/davies/spark","forks_url":"https://api.github.com/repos/davies/spark/forks","keys_url":"https://api.github.com/repos/davies/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/davies/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/davies/spark/teams","hooks_url":"https://api.github.com/repos/davies/spark/hooks","issue_events_url":"https://api.github.com/repos/davies/spark/issues/events{/number}","events_url":"https://api.github.com/repos/davies/spark/events","assignees_url":"https://api.github.com/repos/davies/spark/assignees{/user}","branches_url":"https://api.github.com/repos/davies/spark/branches{/branch}","tags_url":"https://api.github.com/repos/davies/spark/tags","blobs_url":"https://api.github.com/repos/davies/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/davies/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/davies/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/davies/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/davies/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/davies/spark/languages","stargazers_url":"https://api.github.com/repos/davies/spark/stargazers","contributors_url":"https://api.github.com/repos/davies/spark/contributors","subscribers_url":"https://api.github.com/repos/davies/spark/subscribers","subscription_url":"https://api.github.com/repos/davies/spark/subscription","commits_url":"https://api.github.com/repos/davies/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/davies/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/davies/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/davies/spark/issues/comments/{number}","contents_url":"https://api.github.com/repos/davies/spark/contents/{+path}","compare_url":"https://api.github.com/repos/davies/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/davies/spark/merges","archive_url":"https://api.github.com/repos/davies/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/davies/spark/downloads","issues_url":"https://api.github.com/repos/davies/spark/issues{/number}","pulls_url":"https://api.github.com/repos/davies/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/davies/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/davies/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/davies/spark/labels{/name}","releases_url":"https://api.github.com/repos/davies/spark/releases{/id}","created_at":"2014-07-11T06:39:41Z","updated_at":"2014-10-08T20:48:07Z","pushed_at":"2014-11-18T01:12:05Z","git_url":"git://github.com/davies/spark.git","ssh_url":"git@github.com:davies/spark.git","clone_url":"https://github.com/davies/spark.git","svn_url":"https://github.com/davies/spark","homepage":null,"size":86386,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"64c6b9bad559c21f25cd9fbe37c8813cdab939f2","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":"2014-11-18T00:47:59Z","pushed_at":"2014-11-18T00:47:58Z","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":4109280,"stargazers_count":2060,"watchers_count":2060,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1833,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":288,"forks":1833,"open_issues":288,"watchers":2060,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/3320"},"html":{"href":"https://github.com/apache/spark/pull/3320"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/3320"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/3320/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/3320/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/3320/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/89a000fd8e6e15c2ba83d702bbe2f294727f0a4d"}}}}