{"action":"created","comment":{"url":"https://api.github.com/repos/stripe/brushfire/pulls/comments/24946987","id":24946987,"diff_hunk":"@@ -31,6 +32,107 @@ case class Tree[K, V, T](root: Node[K, V, T]) {\n     }\n   }\n \n+  /**\n+   * Prune a tree to minimize validation error.\n+   * Replaces a split with a leaf when it would have a lower error than the child leaves.\n+   *\n+   * @param validationData\n+   * @param start\n+   * @param voter\n+   * @param error\n+   * @param weightMonoid\n+   * @param errorOrdering\n+   * @tparam P\n+   * @tparam E\n+   * @return\n+   */\n+  def prune[P, E](validationData: Map[Int, T], start: Option[Node[K, V, T]] = None, voter: Voter[T, P], error: Error[T, P, E])(implicit weightMonoid: Monoid[T], errorOrdering: Ordering[E]): Tree[K, V, T] = {","path":"brushfire-core/src/main/scala/com/stripe/brushfire/Tree.scala","position":26,"original_position":26,"commit_id":"856adfbedd7813a2e46dae525a27601c969525b5","original_commit_id":"856adfbedd7813a2e46dae525a27601c969525b5","user":{"login":"avibryant","id":9892,"avatar_url":"https://avatars.githubusercontent.com/u/9892?v=3","gravatar_id":"","url":"https://api.github.com/users/avibryant","html_url":"https://github.com/avibryant","followers_url":"https://api.github.com/users/avibryant/followers","following_url":"https://api.github.com/users/avibryant/following{/other_user}","gists_url":"https://api.github.com/users/avibryant/gists{/gist_id}","starred_url":"https://api.github.com/users/avibryant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avibryant/subscriptions","organizations_url":"https://api.github.com/users/avibryant/orgs","repos_url":"https://api.github.com/users/avibryant/repos","events_url":"https://api.github.com/users/avibryant/events{/privacy}","received_events_url":"https://api.github.com/users/avibryant/received_events","type":"User","site_admin":false},"body":"do you expect anyone to ever use the `start` param? Why would we not just prune from the root?","created_at":"2015-02-18T22:23:29Z","updated_at":"2015-02-18T22:23:29Z","html_url":"https://github.com/stripe/brushfire/pull/36#discussion_r24946987","pull_request_url":"https://api.github.com/repos/stripe/brushfire/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/stripe/brushfire/pulls/comments/24946987"},"html":{"href":"https://github.com/stripe/brushfire/pull/36#discussion_r24946987"},"pull_request":{"href":"https://api.github.com/repos/stripe/brushfire/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/stripe/brushfire/pulls/36","id":29568313,"html_url":"https://github.com/stripe/brushfire/pull/36","diff_url":"https://github.com/stripe/brushfire/pull/36.diff","patch_url":"https://github.com/stripe/brushfire/pull/36.patch","issue_url":"https://api.github.com/repos/stripe/brushfire/issues/36","number":36,"state":"open","locked":false,"title":"[WIP] Prune trees to minimize validation error","user":{"login":"roban","id":113354,"avatar_url":"https://avatars.githubusercontent.com/u/113354?v=3","gravatar_id":"","url":"https://api.github.com/users/roban","html_url":"https://github.com/roban","followers_url":"https://api.github.com/users/roban/followers","following_url":"https://api.github.com/users/roban/following{/other_user}","gists_url":"https://api.github.com/users/roban/gists{/gist_id}","starred_url":"https://api.github.com/users/roban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roban/subscriptions","organizations_url":"https://api.github.com/users/roban/orgs","repos_url":"https://api.github.com/users/roban/repos","events_url":"https://api.github.com/users/roban/events{/privacy}","received_events_url":"https://api.github.com/users/roban/received_events","type":"User","site_admin":false},"body":"Very much WIP at the moment, but it compiles, runs, and seems to to do something reasonable.\r\n\r\nI added the digits dataset to have another example, and created `example/iris-prune` and `example/digits-prune` scripts (to run after `example/iris` or `example/digits`).\r\n\r\nAdvice welcome, @avibryant.","created_at":"2015-02-18T22:09:11Z","updated_at":"2015-02-18T22:23:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3bd950b2965bdb771f687f754adb3698f1b85e22","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/stripe/brushfire/pulls/36/commits","review_comments_url":"https://api.github.com/repos/stripe/brushfire/pulls/36/comments","review_comment_url":"https://api.github.com/repos/stripe/brushfire/pulls/comments/{number}","comments_url":"https://api.github.com/repos/stripe/brushfire/issues/36/comments","statuses_url":"https://api.github.com/repos/stripe/brushfire/statuses/856adfbedd7813a2e46dae525a27601c969525b5","head":{"label":"stripe:roban-prune","ref":"roban-prune","sha":"856adfbedd7813a2e46dae525a27601c969525b5","user":{"login":"stripe","id":856813,"avatar_url":"https://avatars.githubusercontent.com/u/856813?v=3","gravatar_id":"","url":"https://api.github.com/users/stripe","html_url":"https://github.com/stripe","followers_url":"https://api.github.com/users/stripe/followers","following_url":"https://api.github.com/users/stripe/following{/other_user}","gists_url":"https://api.github.com/users/stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripe/subscriptions","organizations_url":"https://api.github.com/users/stripe/orgs","repos_url":"https://api.github.com/users/stripe/repos","events_url":"https://api.github.com/users/stripe/events{/privacy}","received_events_url":"https://api.github.com/users/stripe/received_events","type":"Organization","site_admin":false},"repo":{"id":26926567,"name":"brushfire","full_name":"stripe/brushfire","owner":{"login":"stripe","id":856813,"avatar_url":"https://avatars.githubusercontent.com/u/856813?v=3","gravatar_id":"","url":"https://api.github.com/users/stripe","html_url":"https://github.com/stripe","followers_url":"https://api.github.com/users/stripe/followers","following_url":"https://api.github.com/users/stripe/following{/other_user}","gists_url":"https://api.github.com/users/stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripe/subscriptions","organizations_url":"https://api.github.com/users/stripe/orgs","repos_url":"https://api.github.com/users/stripe/repos","events_url":"https://api.github.com/users/stripe/events{/privacy}","received_events_url":"https://api.github.com/users/stripe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stripe/brushfire","description":"Distributed decision tree ensemble learning in Scala","fork":false,"url":"https://api.github.com/repos/stripe/brushfire","forks_url":"https://api.github.com/repos/stripe/brushfire/forks","keys_url":"https://api.github.com/repos/stripe/brushfire/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stripe/brushfire/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stripe/brushfire/teams","hooks_url":"https://api.github.com/repos/stripe/brushfire/hooks","issue_events_url":"https://api.github.com/repos/stripe/brushfire/issues/events{/number}","events_url":"https://api.github.com/repos/stripe/brushfire/events","assignees_url":"https://api.github.com/repos/stripe/brushfire/assignees{/user}","branches_url":"https://api.github.com/repos/stripe/brushfire/branches{/branch}","tags_url":"https://api.github.com/repos/stripe/brushfire/tags","blobs_url":"https://api.github.com/repos/stripe/brushfire/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stripe/brushfire/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stripe/brushfire/git/refs{/sha}","trees_url":"https://api.github.com/repos/stripe/brushfire/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stripe/brushfire/statuses/{sha}","languages_url":"https://api.github.com/repos/stripe/brushfire/languages","stargazers_url":"https://api.github.com/repos/stripe/brushfire/stargazers","contributors_url":"https://api.github.com/repos/stripe/brushfire/contributors","subscribers_url":"https://api.github.com/repos/stripe/brushfire/subscribers","subscription_url":"https://api.github.com/repos/stripe/brushfire/subscription","commits_url":"https://api.github.com/repos/stripe/brushfire/commits{/sha}","git_commits_url":"https://api.github.com/repos/stripe/brushfire/git/commits{/sha}","comments_url":"https://api.github.com/repos/stripe/brushfire/comments{/number}","issue_comment_url":"https://api.github.com/repos/stripe/brushfire/issues/comments/{number}","contents_url":"https://api.github.com/repos/stripe/brushfire/contents/{+path}","compare_url":"https://api.github.com/repos/stripe/brushfire/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stripe/brushfire/merges","archive_url":"https://api.github.com/repos/stripe/brushfire/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stripe/brushfire/downloads","issues_url":"https://api.github.com/repos/stripe/brushfire/issues{/number}","pulls_url":"https://api.github.com/repos/stripe/brushfire/pulls{/number}","milestones_url":"https://api.github.com/repos/stripe/brushfire/milestones{/number}","notifications_url":"https://api.github.com/repos/stripe/brushfire/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stripe/brushfire/labels{/name}","releases_url":"https://api.github.com/repos/stripe/brushfire/releases{/id}","created_at":"2014-11-20T18:47:07Z","updated_at":"2015-02-17T08:35:14Z","pushed_at":"2015-02-18T22:00:42Z","git_url":"git://github.com/stripe/brushfire.git","ssh_url":"git@github.com:stripe/brushfire.git","clone_url":"https://github.com/stripe/brushfire.git","svn_url":"https://github.com/stripe/brushfire","homepage":null,"size":1993,"stargazers_count":133,"watchers_count":133,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":16,"forks":16,"open_issues":16,"watchers":133,"default_branch":"master"}},"base":{"label":"stripe:master","ref":"master","sha":"d922fbe5cb102985e45f498778d7d4d1699570ec","user":{"login":"stripe","id":856813,"avatar_url":"https://avatars.githubusercontent.com/u/856813?v=3","gravatar_id":"","url":"https://api.github.com/users/stripe","html_url":"https://github.com/stripe","followers_url":"https://api.github.com/users/stripe/followers","following_url":"https://api.github.com/users/stripe/following{/other_user}","gists_url":"https://api.github.com/users/stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripe/subscriptions","organizations_url":"https://api.github.com/users/stripe/orgs","repos_url":"https://api.github.com/users/stripe/repos","events_url":"https://api.github.com/users/stripe/events{/privacy}","received_events_url":"https://api.github.com/users/stripe/received_events","type":"Organization","site_admin":false},"repo":{"id":26926567,"name":"brushfire","full_name":"stripe/brushfire","owner":{"login":"stripe","id":856813,"avatar_url":"https://avatars.githubusercontent.com/u/856813?v=3","gravatar_id":"","url":"https://api.github.com/users/stripe","html_url":"https://github.com/stripe","followers_url":"https://api.github.com/users/stripe/followers","following_url":"https://api.github.com/users/stripe/following{/other_user}","gists_url":"https://api.github.com/users/stripe/gists{/gist_id}","starred_url":"https://api.github.com/users/stripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stripe/subscriptions","organizations_url":"https://api.github.com/users/stripe/orgs","repos_url":"https://api.github.com/users/stripe/repos","events_url":"https://api.github.com/users/stripe/events{/privacy}","received_events_url":"https://api.github.com/users/stripe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/stripe/brushfire","description":"Distributed decision tree ensemble learning in Scala","fork":false,"url":"https://api.github.com/repos/stripe/brushfire","forks_url":"https://api.github.com/repos/stripe/brushfire/forks","keys_url":"https://api.github.com/repos/stripe/brushfire/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stripe/brushfire/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stripe/brushfire/teams","hooks_url":"https://api.github.com/repos/stripe/brushfire/hooks","issue_events_url":"https://api.github.com/repos/stripe/brushfire/issues/events{/number}","events_url":"https://api.github.com/repos/stripe/brushfire/events","assignees_url":"https://api.github.com/repos/stripe/brushfire/assignees{/user}","branches_url":"https://api.github.com/repos/stripe/brushfire/branches{/branch}","tags_url":"https://api.github.com/repos/stripe/brushfire/tags","blobs_url":"https://api.github.com/repos/stripe/brushfire/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stripe/brushfire/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stripe/brushfire/git/refs{/sha}","trees_url":"https://api.github.com/repos/stripe/brushfire/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stripe/brushfire/statuses/{sha}","languages_url":"https://api.github.com/repos/stripe/brushfire/languages","stargazers_url":"https://api.github.com/repos/stripe/brushfire/stargazers","contributors_url":"https://api.github.com/repos/stripe/brushfire/contributors","subscribers_url":"https://api.github.com/repos/stripe/brushfire/subscribers","subscription_url":"https://api.github.com/repos/stripe/brushfire/subscription","commits_url":"https://api.github.com/repos/stripe/brushfire/commits{/sha}","git_commits_url":"https://api.github.com/repos/stripe/brushfire/git/commits{/sha}","comments_url":"https://api.github.com/repos/stripe/brushfire/comments{/number}","issue_comment_url":"https://api.github.com/repos/stripe/brushfire/issues/comments/{number}","contents_url":"https://api.github.com/repos/stripe/brushfire/contents/{+path}","compare_url":"https://api.github.com/repos/stripe/brushfire/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stripe/brushfire/merges","archive_url":"https://api.github.com/repos/stripe/brushfire/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stripe/brushfire/downloads","issues_url":"https://api.github.com/repos/stripe/brushfire/issues{/number}","pulls_url":"https://api.github.com/repos/stripe/brushfire/pulls{/number}","milestones_url":"https://api.github.com/repos/stripe/brushfire/milestones{/number}","notifications_url":"https://api.github.com/repos/stripe/brushfire/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stripe/brushfire/labels{/name}","releases_url":"https://api.github.com/repos/stripe/brushfire/releases{/id}","created_at":"2014-11-20T18:47:07Z","updated_at":"2015-02-17T08:35:14Z","pushed_at":"2015-02-18T22:00:42Z","git_url":"git://github.com/stripe/brushfire.git","ssh_url":"git@github.com:stripe/brushfire.git","clone_url":"https://github.com/stripe/brushfire.git","svn_url":"https://github.com/stripe/brushfire","homepage":null,"size":1993,"stargazers_count":133,"watchers_count":133,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":16,"forks":16,"open_issues":16,"watchers":133,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/stripe/brushfire/pulls/36"},"html":{"href":"https://github.com/stripe/brushfire/pull/36"},"issue":{"href":"https://api.github.com/repos/stripe/brushfire/issues/36"},"comments":{"href":"https://api.github.com/repos/stripe/brushfire/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/stripe/brushfire/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/stripe/brushfire/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/stripe/brushfire/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/stripe/brushfire/statuses/856adfbedd7813a2e46dae525a27601c969525b5"}}}}