GitHub PullRequestReviewCommentEvent at 2014-06-28 13:20:58
Repository: xapian
Actor: ojwb
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/xapian/xapian/pulls/comments/14324058","id":14324058,"diff_hunk":"@@ -83,16 +80,43 @@ BB2Weight::init(double factor_)\n     wdfn_upper *= log2(1 + (param_c * get_average_length()) /\n \t\t    get_doclength_lower_bound());\n \n-    double B_max = (F + 1.0) / (get_termfreq() * (wdfn_lower + 1.0));\n+    /* Calculate constant values to be used in get_sumpart(). */\n+    c_product_avlen = param_c * get_average_length();\n+    B_constant = get_wqf() * factor * (F + 1.0) / get_termfreq();\n+    // This weighting scheme causes an error if N = 1 as that will cause\n+    // N - 1.0 to be equal to zero which is used inside a logarithm.\n+    wt = - log2(N - 1.0) - (1 / base_change);\n+    stirling_constant_1 = log2(N + F - 1.0);\n+    stirling_constant_2 = log2(F);\n+\n+    double B_max = B_constant / (wdfn_lower + 1.0);\n+\n+    // Maximize the stirling value to be used in the upper bound.\n+    // Calculate the individual terms keeping the maximization of stirling value\n+    // in mind.\n+    double y_max = N + F - wdfn_lower - 2.0;\n+    double y_min = F - wdfn_upper;\n+    // If the terms result in a negative value, make them positive as negative\n+    // values can not be used in a logrithm.\n+    if (y_min < 0)\n+\ty_min = F;\n+    if (y_max < 0)\n+\ty_max = N + F;","path":"xapian-core/weight/bb2weight.cc","position":60,"original_position":60,"commit_id":"7c01f5f058085669ae04c247ac6b6648b302140c","original_commit_id":"7c01f5f058085669ae04c247ac6b6648b302140c","user":{"login":"ojwb","id":164061,"avatar_url":"https://avatars.githubusercontent.com/u/164061?","gravatar_id":"bbd3df6332d443c182a630e164419687","url":"https://api.github.com/users/ojwb","html_url":"https://github.com/ojwb","followers_url":"https://api.github.com/users/ojwb/followers","following_url":"https://api.github.com/users/ojwb/following{/other_user}","gists_url":"https://api.github.com/users/ojwb/gists{/gist_id}","starred_url":"https://api.github.com/users/ojwb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ojwb/subscriptions","organizations_url":"https://api.github.com/users/ojwb/orgs","repos_url":"https://api.github.com/users/ojwb/repos","events_url":"https://api.github.com/users/ojwb/events{/privacy}","received_events_url":"https://api.github.com/users/ojwb/received_events","type":"User","site_admin":false},"body":"You seem to have ignored this comment I made here a few days ago:\r\n\r\nI'm not clear this makes sense.\r\n\r\nFor a start, we don't want to evaluate log2(0) so the y_max < 0 check isn't right. But log gets very large (in magnitude - it's negative of course) as the argument approaches 0 from above, so even y_max <= 0 may not be enough. Is y some meaningful quantity?\r\n\r\nAlso, if the value is negative, why is it reset to above the largest possible value?\r\n\r\nI wonder if clamping y_min and y_max to be >= 1 makes more sense, or perhaps >= some small but positive number.","created_at":"2014-06-28T13:20:58Z","updated_at":"2014-06-28T13:20:58Z","html_url":"https://github.com/xapian/xapian/pull/43#discussion_r14324058","pull_request_url":"https://api.github.com/repos/xapian/xapian/pulls/43","_links":{"self":{"href":"https://api.github.com/repos/xapian/xapian/pulls/comments/14324058"},"html":{"href":"https://github.com/xapian/xapian/pull/43#discussion_r14324058"},"pull_request":{"href":"https://api.github.com/repos/xapian/xapian/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/xapian/xapian/pulls/43","id":17140737,"html_url":"https://github.com/xapian/xapian/pull/43","diff_url":"https://github.com/xapian/xapian/pull/43.diff","patch_url":"https://github.com/xapian/xapian/pull/43.patch","issue_url":"https://api.github.com/repos/xapian/xapian/issues/43","number":43,"state":"open","title":"Bb2 optimization","user":{"login":"aarshkshah1992","id":3341710,"avatar_url":"https://avatars.githubusercontent.com/u/3341710?","gravatar_id":"552711afab51f984cac94b1765d7d74d","url":"https://api.github.com/users/aarshkshah1992","html_url":"https://github.com/aarshkshah1992","followers_url":"https://api.github.com/users/aarshkshah1992/followers","following_url":"https://api.github.com/users/aarshkshah1992/following{/other_user}","gists_url":"https://api.github.com/users/aarshkshah1992/gists{/gist_id}","starred_url":"https://api.github.com/users/aarshkshah1992/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aarshkshah1992/subscriptions","organizations_url":"https://api.github.com/users/aarshkshah1992/orgs","repos_url":"https://api.github.com/users/aarshkshah1992/repos","events_url":"https://api.github.com/users/aarshkshah1992/events{/privacy}","received_events_url":"https://api.github.com/users/aarshkshah1992/received_events","type":"User","site_admin":false},"body":"Optimization of the BB2 scheme.","created_at":"2014-06-14T06:20:54Z","updated_at":"2014-06-28T13:20:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d4f50a43e652ba2ea8f4b95f0c26cfb633f25796","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/xapian/xapian/pulls/43/commits","review_comments_url":"https://api.github.com/repos/xapian/xapian/pulls/43/comments","review_comment_url":"https://api.github.com/repos/xapian/xapian/pulls/comments/{number}","comments_url":"https://api.github.com/repos/xapian/xapian/issues/43/comments","statuses_url":"https://api.github.com/repos/xapian/xapian/statuses/7c01f5f058085669ae04c247ac6b6648b302140c","head":{"label":"aarshkshah1992:bb2_optimization","ref":"bb2_optimization","sha":"7c01f5f058085669ae04c247ac6b6648b302140c","user":{"login":"aarshkshah1992","id":3341710,"avatar_url":"https://avatars.githubusercontent.com/u/3341710?","gravatar_id":"552711afab51f984cac94b1765d7d74d","url":"https://api.github.com/users/aarshkshah1992","html_url":"https://github.com/aarshkshah1992","followers_url":"https://api.github.com/users/aarshkshah1992/followers","following_url":"https://api.github.com/users/aarshkshah1992/following{/other_user}","gists_url":"https://api.github.com/users/aarshkshah1992/gists{/gist_id}","starred_url":"https://api.github.com/users/aarshkshah1992/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aarshkshah1992/subscriptions","organizations_url":"https://api.github.com/users/aarshkshah1992/orgs","repos_url":"https://api.github.com/users/aarshkshah1992/repos","events_url":"https://api.github.com/users/aarshkshah1992/events{/privacy}","received_events_url":"https://api.github.com/users/aarshkshah1992/received_events","type":"User","site_admin":false},"repo":{"id":8416494,"name":"xapian","full_name":"aarshkshah1992/xapian","owner":{"login":"aarshkshah1992","id":3341710,"avatar_url":"https://avatars.githubusercontent.com/u/3341710?","gravatar_id":"552711afab51f984cac94b1765d7d74d","url":"https://api.github.com/users/aarshkshah1992","html_url":"https://github.com/aarshkshah1992","followers_url":"https://api.github.com/users/aarshkshah1992/followers","following_url":"https://api.github.com/users/aarshkshah1992/following{/other_user}","gists_url":"https://api.github.com/users/aarshkshah1992/gists{/gist_id}","starred_url":"https://api.github.com/users/aarshkshah1992/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aarshkshah1992/subscriptions","organizations_url":"https://api.github.com/users/aarshkshah1992/orgs","repos_url":"https://api.github.com/users/aarshkshah1992/repos","events_url":"https://api.github.com/users/aarshkshah1992/events{/privacy}","received_events_url":"https://api.github.com/users/aarshkshah1992/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aarshkshah1992/xapian","description":"Mirror of the Xapian SVN repository","fork":true,"url":"https://api.github.com/repos/aarshkshah1992/xapian","forks_url":"https://api.github.com/repos/aarshkshah1992/xapian/forks","keys_url":"https://api.github.com/repos/aarshkshah1992/xapian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aarshkshah1992/xapian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aarshkshah1992/xapian/teams","hooks_url":"https://api.github.com/repos/aarshkshah1992/xapian/hooks","issue_events_url":"https://api.github.com/repos/aarshkshah1992/xapian/issues/events{/number}","events_url":"https://api.github.com/repos/aarshkshah1992/xapian/events","assignees_url":"https://api.github.com/repos/aarshkshah1992/xapian/assignees{/user}","branches_url":"https://api.github.com/repos/aarshkshah1992/xapian/branches{/branch}","tags_url":"https://api.github.com/repos/aarshkshah1992/xapian/tags","blobs_url":"https://api.github.com/repos/aarshkshah1992/xapian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aarshkshah1992/xapian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aarshkshah1992/xapian/git/refs{/sha}","trees_url":"https://api.github.com/repos/aarshkshah1992/xapian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aarshkshah1992/xapian/statuses/{sha}","languages_url":"https://api.github.com/repos/aarshkshah1992/xapian/languages","stargazers_url":"https://api.github.com/repos/aarshkshah1992/xapian/stargazers","contributors_url":"https://api.github.com/repos/aarshkshah1992/xapian/contributors","subscribers_url":"https://api.github.com/repos/aarshkshah1992/xapian/subscribers","subscription_url":"https://api.github.com/repos/aarshkshah1992/xapian/subscription","commits_url":"https://api.github.com/repos/aarshkshah1992/xapian/commits{/sha}","git_commits_url":"https://api.github.com/repos/aarshkshah1992/xapian/git/commits{/sha}","comments_url":"https://api.github.com/repos/aarshkshah1992/xapian/comments{/number}","issue_comment_url":"https://api.github.com/repos/aarshkshah1992/xapian/issues/comments/{number}","contents_url":"https://api.github.com/repos/aarshkshah1992/xapian/contents/{+path}","compare_url":"https://api.github.com/repos/aarshkshah1992/xapian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aarshkshah1992/xapian/merges","archive_url":"https://api.github.com/repos/aarshkshah1992/xapian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aarshkshah1992/xapian/downloads","issues_url":"https://api.github.com/repos/aarshkshah1992/xapian/issues{/number}","pulls_url":"https://api.github.com/repos/aarshkshah1992/xapian/pulls{/number}","milestones_url":"https://api.github.com/repos/aarshkshah1992/xapian/milestones{/number}","notifications_url":"https://api.github.com/repos/aarshkshah1992/xapian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aarshkshah1992/xapian/labels{/name}","releases_url":"https://api.github.com/repos/aarshkshah1992/xapian/releases{/id}","created_at":"2013-02-25T19:34:50Z","updated_at":"2014-06-24T04:20:59Z","pushed_at":"2014-06-26T04:39:40Z","git_url":"git://github.com/aarshkshah1992/xapian.git","ssh_url":"git@github.com:aarshkshah1992/xapian.git","clone_url":"https://github.com/aarshkshah1992/xapian.git","svn_url":"https://github.com/aarshkshah1992/xapian","homepage":"http://xapian.org/","size":47060,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_downloads":false,"has_wiki":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"xapian:master","ref":"master","sha":"31a748fe95decacbe33c96b11e12adce5d619d6a","user":{"login":"xapian","id":312861,"avatar_url":"https://avatars.githubusercontent.com/u/312861?","gravatar_id":"d6798b53da0bec5e0de51401aeb7827d","url":"https://api.github.com/users/xapian","html_url":"https://github.com/xapian","followers_url":"https://api.github.com/users/xapian/followers","following_url":"https://api.github.com/users/xapian/following{/other_user}","gists_url":"https://api.github.com/users/xapian/gists{/gist_id}","starred_url":"https://api.github.com/users/xapian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xapian/subscriptions","organizations_url":"https://api.github.com/users/xapian/orgs","repos_url":"https://api.github.com/users/xapian/repos","events_url":"https://api.github.com/users/xapian/events{/privacy}","received_events_url":"https://api.github.com/users/xapian/received_events","type":"Organization","site_admin":false},"repo":{"id":735981,"name":"xapian","full_name":"xapian/xapian","owner":{"login":"xapian","id":312861,"avatar_url":"https://avatars.githubusercontent.com/u/312861?","gravatar_id":"d6798b53da0bec5e0de51401aeb7827d","url":"https://api.github.com/users/xapian","html_url":"https://github.com/xapian","followers_url":"https://api.github.com/users/xapian/followers","following_url":"https://api.github.com/users/xapian/following{/other_user}","gists_url":"https://api.github.com/users/xapian/gists{/gist_id}","starred_url":"https://api.github.com/users/xapian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xapian/subscriptions","organizations_url":"https://api.github.com/users/xapian/orgs","repos_url":"https://api.github.com/users/xapian/repos","events_url":"https://api.github.com/users/xapian/events{/privacy}","received_events_url":"https://api.github.com/users/xapian/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xapian/xapian","description":"Mirror of the Xapian SVN repository","fork":false,"url":"https://api.github.com/repos/xapian/xapian","forks_url":"https://api.github.com/repos/xapian/xapian/forks","keys_url":"https://api.github.com/repos/xapian/xapian/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xapian/xapian/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xapian/xapian/teams","hooks_url":"https://api.github.com/repos/xapian/xapian/hooks","issue_events_url":"https://api.github.com/repos/xapian/xapian/issues/events{/number}","events_url":"https://api.github.com/repos/xapian/xapian/events","assignees_url":"https://api.github.com/repos/xapian/xapian/assignees{/user}","branches_url":"https://api.github.com/repos/xapian/xapian/branches{/branch}","tags_url":"https://api.github.com/repos/xapian/xapian/tags","blobs_url":"https://api.github.com/repos/xapian/xapian/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xapian/xapian/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xapian/xapian/git/refs{/sha}","trees_url":"https://api.github.com/repos/xapian/xapian/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xapian/xapian/statuses/{sha}","languages_url":"https://api.github.com/repos/xapian/xapian/languages","stargazers_url":"https://api.github.com/repos/xapian/xapian/stargazers","contributors_url":"https://api.github.com/repos/xapian/xapian/contributors","subscribers_url":"https://api.github.com/repos/xapian/xapian/subscribers","subscription_url":"https://api.github.com/repos/xapian/xapian/subscription","commits_url":"https://api.github.com/repos/xapian/xapian/commits{/sha}","git_commits_url":"https://api.github.com/repos/xapian/xapian/git/commits{/sha}","comments_url":"https://api.github.com/repos/xapian/xapian/comments{/number}","issue_comment_url":"https://api.github.com/repos/xapian/xapian/issues/comments/{number}","contents_url":"https://api.github.com/repos/xapian/xapian/contents/{+path}","compare_url":"https://api.github.com/repos/xapian/xapian/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xapian/xapian/merges","archive_url":"https://api.github.com/repos/xapian/xapian/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xapian/xapian/downloads","issues_url":"https://api.github.com/repos/xapian/xapian/issues{/number}","pulls_url":"https://api.github.com/repos/xapian/xapian/pulls{/number}","milestones_url":"https://api.github.com/repos/xapian/xapian/milestones{/number}","notifications_url":"https://api.github.com/repos/xapian/xapian/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xapian/xapian/labels{/name}","releases_url":"https://api.github.com/repos/xapian/xapian/releases{/id}","created_at":"2010-06-23T15:51:03Z","updated_at":"2014-06-28T03:59:26Z","pushed_at":"2014-06-28T11:26:15Z","git_url":"git://github.com/xapian/xapian.git","ssh_url":"git@github.com:xapian/xapian.git","clone_url":"https://github.com/xapian/xapian.git","svn_url":"https://github.com/xapian/xapian","homepage":"http://xapian.org/","size":71471,"stargazers_count":131,"watchers_count":131,"language":"C++","has_issues":false,"has_downloads":false,"has_wiki":false,"forks_count":75,"mirror_url":null,"open_issues_count":7,"forks":75,"open_issues":7,"watchers":131,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xapian/xapian/pulls/43"},"html":{"href":"https://github.com/xapian/xapian/pull/43"},"issue":{"href":"https://api.github.com/repos/xapian/xapian/issues/43"},"comments":{"href":"https://api.github.com/repos/xapian/xapian/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/xapian/xapian/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/xapian/xapian/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/xapian/xapian/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/xapian/xapian/statuses/7c01f5f058085669ae04c247ac6b6648b302140c"}}}}