{"action":"created","comment":{"url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/comments/149811595","pull_request_review_id":75267119,"id":149811595,"diff_hunk":"@@ -964,3 +964,33 @@ def bfmi(trace):\n     energy = trace['energy']\n \n     return np.square(np.diff(energy)).mean() / np.var(energy)\n+\n+\n+def r2_score(y_true, y_pred):\n+    R\"\"\"R-squared for Bayesian regression models. Only valid for linear models.\n+    http://www.stat.columbia.edu/%7Egelman/research/unpublished/bayes_R2.pdf\n+\n+    Parameters\n+    ----------\n+    y_true: : array-like of shape = (n_samples) or (n_samples, n_outputs)\n+        Ground truth (correct) target values.\n+    y_pred : array-like of shape = (n_samples) or (n_samples, n_outputs)\n+        Estimated target values.\n+\n+    Returns\n+    -------\n+    `namedtuple` with the following elements:\n+    R2_median: median of the Bayesian R2\n+    R2_mean: mean of the Bayesian R2\n+    R2_std: standard deviation of the Bayesian R2\n+    \"\"\"\n+    e = y_true - y_pred\n+    var_y_est = np.var(y_pred, 1)","path":"pymc3/stats.py","position":34,"original_position":34,"commit_id":"6ac9b6656263cd7da8b0ef37d9fd4992a652c947","original_commit_id":"6ac9b6656263cd7da8b0ef37d9fd4992a652c947","user":{"login":"aloctavodia","id":1338958,"avatar_url":"https://avatars1.githubusercontent.com/u/1338958?v=4","gravatar_id":"","url":"https://api.github.com/users/aloctavodia","html_url":"https://github.com/aloctavodia","followers_url":"https://api.github.com/users/aloctavodia/followers","following_url":"https://api.github.com/users/aloctavodia/following{/other_user}","gists_url":"https://api.github.com/users/aloctavodia/gists{/gist_id}","starred_url":"https://api.github.com/users/aloctavodia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aloctavodia/subscriptions","organizations_url":"https://api.github.com/users/aloctavodia/orgs","repos_url":"https://api.github.com/users/aloctavodia/repos","events_url":"https://api.github.com/users/aloctavodia/events{/privacy}","received_events_url":"https://api.github.com/users/aloctavodia/received_events","type":"User","site_admin":false},"body":"This is going to fail if `y_pred`has dimension 1.","created_at":"2017-11-08T22:08:43Z","updated_at":"2017-11-08T22:14:16Z","html_url":"https://github.com/pymc-devs/pymc3/pull/2696#discussion_r149811595","pull_request_url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/2696","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/comments/149811595"},"html":{"href":"https://github.com/pymc-devs/pymc3/pull/2696#discussion_r149811595"},"pull_request":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/2696"}}},"pull_request":{"url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/2696","id":151505481,"html_url":"https://github.com/pymc-devs/pymc3/pull/2696","diff_url":"https://github.com/pymc-devs/pymc3/pull/2696.diff","patch_url":"https://github.com/pymc-devs/pymc3/pull/2696.patch","issue_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/2696","number":2696,"state":"open","locked":false,"title":"R2_score for GLM","user":{"login":"denadai2","id":190799,"avatar_url":"https://avatars1.githubusercontent.com/u/190799?v=4","gravatar_id":"","url":"https://api.github.com/users/denadai2","html_url":"https://github.com/denadai2","followers_url":"https://api.github.com/users/denadai2/followers","following_url":"https://api.github.com/users/denadai2/following{/other_user}","gists_url":"https://api.github.com/users/denadai2/gists{/gist_id}","starred_url":"https://api.github.com/users/denadai2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denadai2/subscriptions","organizations_url":"https://api.github.com/users/denadai2/orgs","repos_url":"https://api.github.com/users/denadai2/repos","events_url":"https://api.github.com/users/denadai2/events{/privacy}","received_events_url":"https://api.github.com/users/denadai2/received_events","type":"User","site_admin":false},"body":"Fixes #2564.\r\n\r\nRef #2605.","created_at":"2017-11-08T21:52:39Z","updated_at":"2017-11-08T22:14:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"17c0d328b66c29cf3fe94162b2f891f66e8a1a55","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/2696/commits","review_comments_url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/2696/comments","review_comment_url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/2696/comments","statuses_url":"https://api.github.com/repos/pymc-devs/pymc3/statuses/6ac9b6656263cd7da8b0ef37d9fd4992a652c947","head":{"label":"denadai2:r2_score2","ref":"r2_score2","sha":"6ac9b6656263cd7da8b0ef37d9fd4992a652c947","user":{"login":"denadai2","id":190799,"avatar_url":"https://avatars1.githubusercontent.com/u/190799?v=4","gravatar_id":"","url":"https://api.github.com/users/denadai2","html_url":"https://github.com/denadai2","followers_url":"https://api.github.com/users/denadai2/followers","following_url":"https://api.github.com/users/denadai2/following{/other_user}","gists_url":"https://api.github.com/users/denadai2/gists{/gist_id}","starred_url":"https://api.github.com/users/denadai2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denadai2/subscriptions","organizations_url":"https://api.github.com/users/denadai2/orgs","repos_url":"https://api.github.com/users/denadai2/repos","events_url":"https://api.github.com/users/denadai2/events{/privacy}","received_events_url":"https://api.github.com/users/denadai2/received_events","type":"User","site_admin":false},"repo":{"id":88747056,"name":"pymc3","full_name":"denadai2/pymc3","owner":{"login":"denadai2","id":190799,"avatar_url":"https://avatars1.githubusercontent.com/u/190799?v=4","gravatar_id":"","url":"https://api.github.com/users/denadai2","html_url":"https://github.com/denadai2","followers_url":"https://api.github.com/users/denadai2/followers","following_url":"https://api.github.com/users/denadai2/following{/other_user}","gists_url":"https://api.github.com/users/denadai2/gists{/gist_id}","starred_url":"https://api.github.com/users/denadai2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denadai2/subscriptions","organizations_url":"https://api.github.com/users/denadai2/orgs","repos_url":"https://api.github.com/users/denadai2/repos","events_url":"https://api.github.com/users/denadai2/events{/privacy}","received_events_url":"https://api.github.com/users/denadai2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/denadai2/pymc3","description":"Probabilistic Programming in Python: Bayesian Modeling and Probabilistic Machine Learning with Theano","fork":true,"url":"https://api.github.com/repos/denadai2/pymc3","forks_url":"https://api.github.com/repos/denadai2/pymc3/forks","keys_url":"https://api.github.com/repos/denadai2/pymc3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/denadai2/pymc3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/denadai2/pymc3/teams","hooks_url":"https://api.github.com/repos/denadai2/pymc3/hooks","issue_events_url":"https://api.github.com/repos/denadai2/pymc3/issues/events{/number}","events_url":"https://api.github.com/repos/denadai2/pymc3/events","assignees_url":"https://api.github.com/repos/denadai2/pymc3/assignees{/user}","branches_url":"https://api.github.com/repos/denadai2/pymc3/branches{/branch}","tags_url":"https://api.github.com/repos/denadai2/pymc3/tags","blobs_url":"https://api.github.com/repos/denadai2/pymc3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/denadai2/pymc3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/denadai2/pymc3/git/refs{/sha}","trees_url":"https://api.github.com/repos/denadai2/pymc3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/denadai2/pymc3/statuses/{sha}","languages_url":"https://api.github.com/repos/denadai2/pymc3/languages","stargazers_url":"https://api.github.com/repos/denadai2/pymc3/stargazers","contributors_url":"https://api.github.com/repos/denadai2/pymc3/contributors","subscribers_url":"https://api.github.com/repos/denadai2/pymc3/subscribers","subscription_url":"https://api.github.com/repos/denadai2/pymc3/subscription","commits_url":"https://api.github.com/repos/denadai2/pymc3/commits{/sha}","git_commits_url":"https://api.github.com/repos/denadai2/pymc3/git/commits{/sha}","comments_url":"https://api.github.com/repos/denadai2/pymc3/comments{/number}","issue_comment_url":"https://api.github.com/repos/denadai2/pymc3/issues/comments{/number}","contents_url":"https://api.github.com/repos/denadai2/pymc3/contents/{+path}","compare_url":"https://api.github.com/repos/denadai2/pymc3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/denadai2/pymc3/merges","archive_url":"https://api.github.com/repos/denadai2/pymc3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/denadai2/pymc3/downloads","issues_url":"https://api.github.com/repos/denadai2/pymc3/issues{/number}","pulls_url":"https://api.github.com/repos/denadai2/pymc3/pulls{/number}","milestones_url":"https://api.github.com/repos/denadai2/pymc3/milestones{/number}","notifications_url":"https://api.github.com/repos/denadai2/pymc3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/denadai2/pymc3/labels{/name}","releases_url":"https://api.github.com/repos/denadai2/pymc3/releases{/id}","deployments_url":"https://api.github.com/repos/denadai2/pymc3/deployments","created_at":"2017-04-19T13:14:11Z","updated_at":"2017-04-19T13:14:14Z","pushed_at":"2017-11-08T21:51:44Z","git_url":"git://github.com/denadai2/pymc3.git","ssh_url":"git@github.com:denadai2/pymc3.git","clone_url":"https://github.com/denadai2/pymc3.git","svn_url":"https://github.com/denadai2/pymc3","homepage":"http://pymc-devs.github.io/pymc3/","size":273993,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pymc-devs:master","ref":"master","sha":"9bc7d2c0b9865c41eeb3ca57e03f87be9cf5b828","user":{"login":"pymc-devs","id":81121,"avatar_url":"https://avatars3.githubusercontent.com/u/81121?v=4","gravatar_id":"","url":"https://api.github.com/users/pymc-devs","html_url":"https://github.com/pymc-devs","followers_url":"https://api.github.com/users/pymc-devs/followers","following_url":"https://api.github.com/users/pymc-devs/following{/other_user}","gists_url":"https://api.github.com/users/pymc-devs/gists{/gist_id}","starred_url":"https://api.github.com/users/pymc-devs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pymc-devs/subscriptions","organizations_url":"https://api.github.com/users/pymc-devs/orgs","repos_url":"https://api.github.com/users/pymc-devs/repos","events_url":"https://api.github.com/users/pymc-devs/events{/privacy}","received_events_url":"https://api.github.com/users/pymc-devs/received_events","type":"Organization","site_admin":false},"repo":{"id":192904,"name":"pymc3","full_name":"pymc-devs/pymc3","owner":{"login":"pymc-devs","id":81121,"avatar_url":"https://avatars3.githubusercontent.com/u/81121?v=4","gravatar_id":"","url":"https://api.github.com/users/pymc-devs","html_url":"https://github.com/pymc-devs","followers_url":"https://api.github.com/users/pymc-devs/followers","following_url":"https://api.github.com/users/pymc-devs/following{/other_user}","gists_url":"https://api.github.com/users/pymc-devs/gists{/gist_id}","starred_url":"https://api.github.com/users/pymc-devs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pymc-devs/subscriptions","organizations_url":"https://api.github.com/users/pymc-devs/orgs","repos_url":"https://api.github.com/users/pymc-devs/repos","events_url":"https://api.github.com/users/pymc-devs/events{/privacy}","received_events_url":"https://api.github.com/users/pymc-devs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pymc-devs/pymc3","description":"Probabilistic Programming in Python: Bayesian Modeling and Probabilistic Machine Learning with Theano","fork":false,"url":"https://api.github.com/repos/pymc-devs/pymc3","forks_url":"https://api.github.com/repos/pymc-devs/pymc3/forks","keys_url":"https://api.github.com/repos/pymc-devs/pymc3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pymc-devs/pymc3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pymc-devs/pymc3/teams","hooks_url":"https://api.github.com/repos/pymc-devs/pymc3/hooks","issue_events_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/events{/number}","events_url":"https://api.github.com/repos/pymc-devs/pymc3/events","assignees_url":"https://api.github.com/repos/pymc-devs/pymc3/assignees{/user}","branches_url":"https://api.github.com/repos/pymc-devs/pymc3/branches{/branch}","tags_url":"https://api.github.com/repos/pymc-devs/pymc3/tags","blobs_url":"https://api.github.com/repos/pymc-devs/pymc3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pymc-devs/pymc3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pymc-devs/pymc3/git/refs{/sha}","trees_url":"https://api.github.com/repos/pymc-devs/pymc3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pymc-devs/pymc3/statuses/{sha}","languages_url":"https://api.github.com/repos/pymc-devs/pymc3/languages","stargazers_url":"https://api.github.com/repos/pymc-devs/pymc3/stargazers","contributors_url":"https://api.github.com/repos/pymc-devs/pymc3/contributors","subscribers_url":"https://api.github.com/repos/pymc-devs/pymc3/subscribers","subscription_url":"https://api.github.com/repos/pymc-devs/pymc3/subscription","commits_url":"https://api.github.com/repos/pymc-devs/pymc3/commits{/sha}","git_commits_url":"https://api.github.com/repos/pymc-devs/pymc3/git/commits{/sha}","comments_url":"https://api.github.com/repos/pymc-devs/pymc3/comments{/number}","issue_comment_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/comments{/number}","contents_url":"https://api.github.com/repos/pymc-devs/pymc3/contents/{+path}","compare_url":"https://api.github.com/repos/pymc-devs/pymc3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pymc-devs/pymc3/merges","archive_url":"https://api.github.com/repos/pymc-devs/pymc3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pymc-devs/pymc3/downloads","issues_url":"https://api.github.com/repos/pymc-devs/pymc3/issues{/number}","pulls_url":"https://api.github.com/repos/pymc-devs/pymc3/pulls{/number}","milestones_url":"https://api.github.com/repos/pymc-devs/pymc3/milestones{/number}","notifications_url":"https://api.github.com/repos/pymc-devs/pymc3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pymc-devs/pymc3/labels{/name}","releases_url":"https://api.github.com/repos/pymc-devs/pymc3/releases{/id}","deployments_url":"https://api.github.com/repos/pymc-devs/pymc3/deployments","created_at":"2009-05-05T09:43:50Z","updated_at":"2017-11-08T16:44:11Z","pushed_at":"2017-11-08T21:52:40Z","git_url":"git://github.com/pymc-devs/pymc3.git","ssh_url":"git@github.com:pymc-devs/pymc3.git","clone_url":"https://github.com/pymc-devs/pymc3.git","svn_url":"https://github.com/pymc-devs/pymc3","homepage":"http://pymc-devs.github.io/pymc3/","size":320964,"stargazers_count":2618,"watchers_count":2618,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":654,"mirror_url":null,"archived":false,"open_issues_count":243,"forks":654,"open_issues":243,"watchers":2618,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/2696"},"html":{"href":"https://github.com/pymc-devs/pymc3/pull/2696"},"issue":{"href":"https://api.github.com/repos/pymc-devs/pymc3/issues/2696"},"comments":{"href":"https://api.github.com/repos/pymc-devs/pymc3/issues/2696/comments"},"review_comments":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/2696/comments"},"review_comment":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/2696/commits"},"statuses":{"href":"https://api.github.com/repos/pymc-devs/pymc3/statuses/6ac9b6656263cd7da8b0ef37d9fd4992a652c947"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"aloctavodia"}}