{"action":"created","comment":{"url":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls/comments/37965560","id":37965560,"diff_hunk":"@@ -471,3 +471,84 @@ void free_lr(LR * lr){\n }\n \n \n+double pr_eval(double *x, void *_ds) {\n+    LR * lr = (LR *) _ds;\n+    double loss = 1.0, yest = 0.0, add = 0.0, regloss = 0.0;\n+    double *val = lr->train_ds->val;\n+    int    *id  = lr->train_ds->ids;\n+    int    *len = lr->train_ds->l;\n+    double *y   = lr->train_ds->y;\n+    int     row = lr->train_ds->r;\n+    int offs =  0, i = 0, j = 0;\n+\n+    // poisson loss\n+    for (offs = i = 0; i < row; ++i) {\n+        yest = 0.;\n+        if (val) {\n+            for (j = 0; j < len[i]; ++j) {\n+                yest += val[offs + j] * x[id[offs + j]];\n+            }\n+        } else {\n+            for (j = 0; j < len[i]; ++j) {\n+                yest += x[id[offs + j]];\n+            }\n+        }\n+        loss += y[i] * log(yest) - yest;","path":"dm/lr.c","position":26,"original_position":26,"commit_id":"f91a918d6a9699c36d0a331efd2abaa9f5eb0190","original_commit_id":"f91a918d6a9699c36d0a331efd2abaa9f5eb0190","user":{"login":"liuzhiqiangruc","id":12410388,"avatar_url":"https://avatars.githubusercontent.com/u/12410388?v=3","gravatar_id":"","url":"https://api.github.com/users/liuzhiqiangruc","html_url":"https://github.com/liuzhiqiangruc","followers_url":"https://api.github.com/users/liuzhiqiangruc/followers","following_url":"https://api.github.com/users/liuzhiqiangruc/following{/other_user}","gists_url":"https://api.github.com/users/liuzhiqiangruc/gists{/gist_id}","starred_url":"https://api.github.com/users/liuzhiqiangruc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liuzhiqiangruc/subscriptions","organizations_url":"https://api.github.com/users/liuzhiqiangruc/orgs","repos_url":"https://api.github.com/users/liuzhiqiangruc/repos","events_url":"https://api.github.com/users/liuzhiqiangruc/events{/privacy}","received_events_url":"https://api.github.com/users/liuzhiqiangruc/received_events","type":"User","site_admin":false},"body":"loss += y[i]*yest - exp(yest);","created_at":"2015-08-26T10:06:43Z","updated_at":"2015-08-26T10:06:43Z","html_url":"https://github.com/liuzhiqiangruc/dm/pull/8#discussion_r37965560","pull_request_url":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls/comments/37965560"},"html":{"href":"https://github.com/liuzhiqiangruc/dm/pull/8#discussion_r37965560"},"pull_request":{"href":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls/8","id":43133420,"html_url":"https://github.com/liuzhiqiangruc/dm/pull/8","diff_url":"https://github.com/liuzhiqiangruc/dm/pull/8.diff","patch_url":"https://github.com/liuzhiqiangruc/dm/pull/8.patch","issue_url":"https://api.github.com/repos/liuzhiqiangruc/dm/issues/8","number":8,"state":"open","locked":false,"title":"naive add Poisson Regression in dm/lr.c(don't handle yest equal zero situation ","user":{"login":"zengarden","id":2849195,"avatar_url":"https://avatars.githubusercontent.com/u/2849195?v=3","gravatar_id":"","url":"https://api.github.com/users/zengarden","html_url":"https://github.com/zengarden","followers_url":"https://api.github.com/users/zengarden/followers","following_url":"https://api.github.com/users/zengarden/following{/other_user}","gists_url":"https://api.github.com/users/zengarden/gists{/gist_id}","starred_url":"https://api.github.com/users/zengarden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zengarden/subscriptions","organizations_url":"https://api.github.com/users/zengarden/orgs","repos_url":"https://api.github.com/users/zengarden/repos","events_url":"https://api.github.com/users/zengarden/events{/privacy}","received_events_url":"https://api.github.com/users/zengarden/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-24T01:30:51Z","updated_at":"2015-08-26T10:06:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dac043ff5e552a6506cb5771b7f61c6f85bda3da","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls/8/commits","review_comments_url":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls/8/comments","review_comment_url":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/liuzhiqiangruc/dm/issues/8/comments","statuses_url":"https://api.github.com/repos/liuzhiqiangruc/dm/statuses/f91a918d6a9699c36d0a331efd2abaa9f5eb0190","head":{"label":"zengarden:master","ref":"master","sha":"f91a918d6a9699c36d0a331efd2abaa9f5eb0190","user":{"login":"zengarden","id":2849195,"avatar_url":"https://avatars.githubusercontent.com/u/2849195?v=3","gravatar_id":"","url":"https://api.github.com/users/zengarden","html_url":"https://github.com/zengarden","followers_url":"https://api.github.com/users/zengarden/followers","following_url":"https://api.github.com/users/zengarden/following{/other_user}","gists_url":"https://api.github.com/users/zengarden/gists{/gist_id}","starred_url":"https://api.github.com/users/zengarden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zengarden/subscriptions","organizations_url":"https://api.github.com/users/zengarden/orgs","repos_url":"https://api.github.com/users/zengarden/repos","events_url":"https://api.github.com/users/zengarden/events{/privacy}","received_events_url":"https://api.github.com/users/zengarden/received_events","type":"User","site_admin":false},"repo":{"id":41015255,"name":"dm","full_name":"zengarden/dm","owner":{"login":"zengarden","id":2849195,"avatar_url":"https://avatars.githubusercontent.com/u/2849195?v=3","gravatar_id":"","url":"https://api.github.com/users/zengarden","html_url":"https://github.com/zengarden","followers_url":"https://api.github.com/users/zengarden/followers","following_url":"https://api.github.com/users/zengarden/following{/other_user}","gists_url":"https://api.github.com/users/zengarden/gists{/gist_id}","starred_url":"https://api.github.com/users/zengarden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zengarden/subscriptions","organizations_url":"https://api.github.com/users/zengarden/orgs","repos_url":"https://api.github.com/users/zengarden/repos","events_url":"https://api.github.com/users/zengarden/events{/privacy}","received_events_url":"https://api.github.com/users/zengarden/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zengarden/dm","description":"机器学习算法库，涉及Topic Model、矩阵分解、最优化方法(Newton)、时间序列分析等常用挖掘功能.","fork":true,"url":"https://api.github.com/repos/zengarden/dm","forks_url":"https://api.github.com/repos/zengarden/dm/forks","keys_url":"https://api.github.com/repos/zengarden/dm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zengarden/dm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zengarden/dm/teams","hooks_url":"https://api.github.com/repos/zengarden/dm/hooks","issue_events_url":"https://api.github.com/repos/zengarden/dm/issues/events{/number}","events_url":"https://api.github.com/repos/zengarden/dm/events","assignees_url":"https://api.github.com/repos/zengarden/dm/assignees{/user}","branches_url":"https://api.github.com/repos/zengarden/dm/branches{/branch}","tags_url":"https://api.github.com/repos/zengarden/dm/tags","blobs_url":"https://api.github.com/repos/zengarden/dm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zengarden/dm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zengarden/dm/git/refs{/sha}","trees_url":"https://api.github.com/repos/zengarden/dm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zengarden/dm/statuses/{sha}","languages_url":"https://api.github.com/repos/zengarden/dm/languages","stargazers_url":"https://api.github.com/repos/zengarden/dm/stargazers","contributors_url":"https://api.github.com/repos/zengarden/dm/contributors","subscribers_url":"https://api.github.com/repos/zengarden/dm/subscribers","subscription_url":"https://api.github.com/repos/zengarden/dm/subscription","commits_url":"https://api.github.com/repos/zengarden/dm/commits{/sha}","git_commits_url":"https://api.github.com/repos/zengarden/dm/git/commits{/sha}","comments_url":"https://api.github.com/repos/zengarden/dm/comments{/number}","issue_comment_url":"https://api.github.com/repos/zengarden/dm/issues/comments{/number}","contents_url":"https://api.github.com/repos/zengarden/dm/contents/{+path}","compare_url":"https://api.github.com/repos/zengarden/dm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zengarden/dm/merges","archive_url":"https://api.github.com/repos/zengarden/dm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zengarden/dm/downloads","issues_url":"https://api.github.com/repos/zengarden/dm/issues{/number}","pulls_url":"https://api.github.com/repos/zengarden/dm/pulls{/number}","milestones_url":"https://api.github.com/repos/zengarden/dm/milestones{/number}","notifications_url":"https://api.github.com/repos/zengarden/dm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zengarden/dm/labels{/name}","releases_url":"https://api.github.com/repos/zengarden/dm/releases{/id}","created_at":"2015-08-19T05:31:55Z","updated_at":"2015-08-21T01:32:45Z","pushed_at":"2015-08-21T07:43:03Z","git_url":"git://github.com/zengarden/dm.git","ssh_url":"git@github.com:zengarden/dm.git","clone_url":"https://github.com/zengarden/dm.git","svn_url":"https://github.com/zengarden/dm","homepage":"","size":227,"stargazers_count":2,"watchers_count":2,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"liuzhiqiangruc:master","ref":"master","sha":"a39879006068d48418d623a0e7df2f9e7eb35c18","user":{"login":"liuzhiqiangruc","id":12410388,"avatar_url":"https://avatars.githubusercontent.com/u/12410388?v=3","gravatar_id":"","url":"https://api.github.com/users/liuzhiqiangruc","html_url":"https://github.com/liuzhiqiangruc","followers_url":"https://api.github.com/users/liuzhiqiangruc/followers","following_url":"https://api.github.com/users/liuzhiqiangruc/following{/other_user}","gists_url":"https://api.github.com/users/liuzhiqiangruc/gists{/gist_id}","starred_url":"https://api.github.com/users/liuzhiqiangruc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liuzhiqiangruc/subscriptions","organizations_url":"https://api.github.com/users/liuzhiqiangruc/orgs","repos_url":"https://api.github.com/users/liuzhiqiangruc/repos","events_url":"https://api.github.com/users/liuzhiqiangruc/events{/privacy}","received_events_url":"https://api.github.com/users/liuzhiqiangruc/received_events","type":"User","site_admin":false},"repo":{"id":39931464,"name":"dm","full_name":"liuzhiqiangruc/dm","owner":{"login":"liuzhiqiangruc","id":12410388,"avatar_url":"https://avatars.githubusercontent.com/u/12410388?v=3","gravatar_id":"","url":"https://api.github.com/users/liuzhiqiangruc","html_url":"https://github.com/liuzhiqiangruc","followers_url":"https://api.github.com/users/liuzhiqiangruc/followers","following_url":"https://api.github.com/users/liuzhiqiangruc/following{/other_user}","gists_url":"https://api.github.com/users/liuzhiqiangruc/gists{/gist_id}","starred_url":"https://api.github.com/users/liuzhiqiangruc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liuzhiqiangruc/subscriptions","organizations_url":"https://api.github.com/users/liuzhiqiangruc/orgs","repos_url":"https://api.github.com/users/liuzhiqiangruc/repos","events_url":"https://api.github.com/users/liuzhiqiangruc/events{/privacy}","received_events_url":"https://api.github.com/users/liuzhiqiangruc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/liuzhiqiangruc/dm","description":"机器学习算法库，涉及Topic Model、矩阵分解、最优化方法(Newton)、时间序列分析等常用挖掘功能.","fork":false,"url":"https://api.github.com/repos/liuzhiqiangruc/dm","forks_url":"https://api.github.com/repos/liuzhiqiangruc/dm/forks","keys_url":"https://api.github.com/repos/liuzhiqiangruc/dm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/liuzhiqiangruc/dm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/liuzhiqiangruc/dm/teams","hooks_url":"https://api.github.com/repos/liuzhiqiangruc/dm/hooks","issue_events_url":"https://api.github.com/repos/liuzhiqiangruc/dm/issues/events{/number}","events_url":"https://api.github.com/repos/liuzhiqiangruc/dm/events","assignees_url":"https://api.github.com/repos/liuzhiqiangruc/dm/assignees{/user}","branches_url":"https://api.github.com/repos/liuzhiqiangruc/dm/branches{/branch}","tags_url":"https://api.github.com/repos/liuzhiqiangruc/dm/tags","blobs_url":"https://api.github.com/repos/liuzhiqiangruc/dm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/liuzhiqiangruc/dm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/liuzhiqiangruc/dm/git/refs{/sha}","trees_url":"https://api.github.com/repos/liuzhiqiangruc/dm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/liuzhiqiangruc/dm/statuses/{sha}","languages_url":"https://api.github.com/repos/liuzhiqiangruc/dm/languages","stargazers_url":"https://api.github.com/repos/liuzhiqiangruc/dm/stargazers","contributors_url":"https://api.github.com/repos/liuzhiqiangruc/dm/contributors","subscribers_url":"https://api.github.com/repos/liuzhiqiangruc/dm/subscribers","subscription_url":"https://api.github.com/repos/liuzhiqiangruc/dm/subscription","commits_url":"https://api.github.com/repos/liuzhiqiangruc/dm/commits{/sha}","git_commits_url":"https://api.github.com/repos/liuzhiqiangruc/dm/git/commits{/sha}","comments_url":"https://api.github.com/repos/liuzhiqiangruc/dm/comments{/number}","issue_comment_url":"https://api.github.com/repos/liuzhiqiangruc/dm/issues/comments{/number}","contents_url":"https://api.github.com/repos/liuzhiqiangruc/dm/contents/{+path}","compare_url":"https://api.github.com/repos/liuzhiqiangruc/dm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/liuzhiqiangruc/dm/merges","archive_url":"https://api.github.com/repos/liuzhiqiangruc/dm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/liuzhiqiangruc/dm/downloads","issues_url":"https://api.github.com/repos/liuzhiqiangruc/dm/issues{/number}","pulls_url":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls{/number}","milestones_url":"https://api.github.com/repos/liuzhiqiangruc/dm/milestones{/number}","notifications_url":"https://api.github.com/repos/liuzhiqiangruc/dm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/liuzhiqiangruc/dm/labels{/name}","releases_url":"https://api.github.com/repos/liuzhiqiangruc/dm/releases{/id}","created_at":"2015-07-30T04:36:40Z","updated_at":"2015-08-04T02:17:40Z","pushed_at":"2015-08-24T01:30:52Z","git_url":"git://github.com/liuzhiqiangruc/dm.git","ssh_url":"git@github.com:liuzhiqiangruc/dm.git","clone_url":"https://github.com/liuzhiqiangruc/dm.git","svn_url":"https://github.com/liuzhiqiangruc/dm","homepage":"","size":463,"stargazers_count":8,"watchers_count":8,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":1,"forks":4,"open_issues":1,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls/8"},"html":{"href":"https://github.com/liuzhiqiangruc/dm/pull/8"},"issue":{"href":"https://api.github.com/repos/liuzhiqiangruc/dm/issues/8"},"comments":{"href":"https://api.github.com/repos/liuzhiqiangruc/dm/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/liuzhiqiangruc/dm/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/liuzhiqiangruc/dm/statuses/f91a918d6a9699c36d0a331efd2abaa9f5eb0190"}}}}