{"action":"created","comment":{"url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/comments/203755385","pull_request_review_id":138707217,"id":203755385,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzc1NTM4NQ==","diff_hunk":"@@ -171,12 +171,18 @@ def warnings(self):\n         # Generate a global warning for divergences\n         n_divs = self._num_divs_sample\n         if n_divs and self._samples_after_tune == n_divs:\n-            msg = ('The chain contains only diverging samples. The model is '\n-                   'probably misspecified.')\n+            message = ('The chain contains only diverging samples. The model '\n+                       'is probably misspecified.')\n             warning = SamplerWarning(\n-                WarningType.DIVERGENCES, msg, 'error', None, None, None)\n+                WarningType.DIVERGENCES, message, 'error', None, None, None)\n+            warnings.append(warning)\n+        elif n_divs == 1:","path":"pymc3/step_methods/hmc/base_hmc.py","position":12,"original_position":12,"commit_id":"ccf5c933a4bbf496505766f980578184ecfa0110","original_commit_id":"ccf5c933a4bbf496505766f980578184ecfa0110","user":{"login":"fonnesbeck","id":81476,"node_id":"MDQ6VXNlcjgxNDc2","avatar_url":"https://avatars3.githubusercontent.com/u/81476?v=4","gravatar_id":"","url":"https://api.github.com/users/fonnesbeck","html_url":"https://github.com/fonnesbeck","followers_url":"https://api.github.com/users/fonnesbeck/followers","following_url":"https://api.github.com/users/fonnesbeck/following{/other_user}","gists_url":"https://api.github.com/users/fonnesbeck/gists{/gist_id}","starred_url":"https://api.github.com/users/fonnesbeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fonnesbeck/subscriptions","organizations_url":"https://api.github.com/users/fonnesbeck/orgs","repos_url":"https://api.github.com/users/fonnesbeck/repos","events_url":"https://api.github.com/users/fonnesbeck/events{/privacy}","received_events_url":"https://api.github.com/users/fonnesbeck/received_events","type":"User","site_admin":false},"body":"Sounds like a scoping issue. If you instantiate `message` outside the switch statement, it should work. So, something like this:\r\n\r\n```python\r\n        message = ''\r\n        if n_divs and self._samples_after_tune == n_divs:\r\n            message = ('The chain contains only diverging samples. The model '\r\n                       'is probably misspecified.')\r\n        elif n_divs == 1:\r\n            message = ('There was 1 divergence after tuning. Increase '\r\n                       '`target_accept` or reparameterize.')\r\n        elif n_divs > 1:\r\n            message = ('There were %s divergences after tuning. Increase '\r\n                       '`target_accept` or reparameterize.'\r\n                       % n_divs)\r\n        if message:\r\n            warning = SamplerWarning(\r\n                WarningType.DIVERGENCES, message, 'error', None, None, None)\r\n            warnings.append(warning)\r\n\r\n```","created_at":"2018-07-19T14:45:49Z","updated_at":"2018-07-19T14:45:49Z","html_url":"https://github.com/pymc-devs/pymc3/pull/3106#discussion_r203755385","pull_request_url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/3106","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/comments/203755385"},"html":{"href":"https://github.com/pymc-devs/pymc3/pull/3106#discussion_r203755385"},"pull_request":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/3106"}},"in_reply_to_id":203586261},"pull_request":{"url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/3106","id":202387689,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyMzg3Njg5","html_url":"https://github.com/pymc-devs/pymc3/pull/3106","diff_url":"https://github.com/pymc-devs/pymc3/pull/3106.diff","patch_url":"https://github.com/pymc-devs/pymc3/pull/3106.patch","issue_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/3106","number":3106,"state":"open","locked":false,"title":"Fix grammar in divergence warning; refactor code","user":{"login":"eigenfoo","id":19851673,"node_id":"MDQ6VXNlcjE5ODUxNjcz","avatar_url":"https://avatars1.githubusercontent.com/u/19851673?v=4","gravatar_id":"","url":"https://api.github.com/users/eigenfoo","html_url":"https://github.com/eigenfoo","followers_url":"https://api.github.com/users/eigenfoo/followers","following_url":"https://api.github.com/users/eigenfoo/following{/other_user}","gists_url":"https://api.github.com/users/eigenfoo/gists{/gist_id}","starred_url":"https://api.github.com/users/eigenfoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eigenfoo/subscriptions","organizations_url":"https://api.github.com/users/eigenfoo/orgs","repos_url":"https://api.github.com/users/eigenfoo/repos","events_url":"https://api.github.com/users/eigenfoo/events{/privacy}","received_events_url":"https://api.github.com/users/eigenfoo/received_events","type":"User","site_admin":false},"body":"Sorry if this is nitpicky but it's sad to see PyMC3 make a grammatical mistake 😕 \r\n\r\nThis PR changes the error warning for divergences from `There were 1 divergences ...` to `There was 1 divergence ...`. It also refactors the code a bit.","created_at":"2018-07-18T21:38:10Z","updated_at":"2018-07-19T14:45:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e5ec7c7e7435a152dc5fe4d3617c2a27769d045c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/3106/commits","review_comments_url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/3106/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/3106/comments","statuses_url":"https://api.github.com/repos/pymc-devs/pymc3/statuses/ccf5c933a4bbf496505766f980578184ecfa0110","head":{"label":"eigenfoo:fix_div_warning","ref":"fix_div_warning","sha":"ccf5c933a4bbf496505766f980578184ecfa0110","user":{"login":"eigenfoo","id":19851673,"node_id":"MDQ6VXNlcjE5ODUxNjcz","avatar_url":"https://avatars1.githubusercontent.com/u/19851673?v=4","gravatar_id":"","url":"https://api.github.com/users/eigenfoo","html_url":"https://github.com/eigenfoo","followers_url":"https://api.github.com/users/eigenfoo/followers","following_url":"https://api.github.com/users/eigenfoo/following{/other_user}","gists_url":"https://api.github.com/users/eigenfoo/gists{/gist_id}","starred_url":"https://api.github.com/users/eigenfoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eigenfoo/subscriptions","organizations_url":"https://api.github.com/users/eigenfoo/orgs","repos_url":"https://api.github.com/users/eigenfoo/repos","events_url":"https://api.github.com/users/eigenfoo/events{/privacy}","received_events_url":"https://api.github.com/users/eigenfoo/received_events","type":"User","site_admin":false},"repo":{"id":141488272,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE0ODgyNzI=","name":"pymc3","full_name":"eigenfoo/pymc3","owner":{"login":"eigenfoo","id":19851673,"node_id":"MDQ6VXNlcjE5ODUxNjcz","avatar_url":"https://avatars1.githubusercontent.com/u/19851673?v=4","gravatar_id":"","url":"https://api.github.com/users/eigenfoo","html_url":"https://github.com/eigenfoo","followers_url":"https://api.github.com/users/eigenfoo/followers","following_url":"https://api.github.com/users/eigenfoo/following{/other_user}","gists_url":"https://api.github.com/users/eigenfoo/gists{/gist_id}","starred_url":"https://api.github.com/users/eigenfoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eigenfoo/subscriptions","organizations_url":"https://api.github.com/users/eigenfoo/orgs","repos_url":"https://api.github.com/users/eigenfoo/repos","events_url":"https://api.github.com/users/eigenfoo/events{/privacy}","received_events_url":"https://api.github.com/users/eigenfoo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eigenfoo/pymc3","description":"Probabilistic Programming in Python: Bayesian Modeling and Probabilistic Machine Learning with Theano","fork":true,"url":"https://api.github.com/repos/eigenfoo/pymc3","forks_url":"https://api.github.com/repos/eigenfoo/pymc3/forks","keys_url":"https://api.github.com/repos/eigenfoo/pymc3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eigenfoo/pymc3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eigenfoo/pymc3/teams","hooks_url":"https://api.github.com/repos/eigenfoo/pymc3/hooks","issue_events_url":"https://api.github.com/repos/eigenfoo/pymc3/issues/events{/number}","events_url":"https://api.github.com/repos/eigenfoo/pymc3/events","assignees_url":"https://api.github.com/repos/eigenfoo/pymc3/assignees{/user}","branches_url":"https://api.github.com/repos/eigenfoo/pymc3/branches{/branch}","tags_url":"https://api.github.com/repos/eigenfoo/pymc3/tags","blobs_url":"https://api.github.com/repos/eigenfoo/pymc3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eigenfoo/pymc3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eigenfoo/pymc3/git/refs{/sha}","trees_url":"https://api.github.com/repos/eigenfoo/pymc3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eigenfoo/pymc3/statuses/{sha}","languages_url":"https://api.github.com/repos/eigenfoo/pymc3/languages","stargazers_url":"https://api.github.com/repos/eigenfoo/pymc3/stargazers","contributors_url":"https://api.github.com/repos/eigenfoo/pymc3/contributors","subscribers_url":"https://api.github.com/repos/eigenfoo/pymc3/subscribers","subscription_url":"https://api.github.com/repos/eigenfoo/pymc3/subscription","commits_url":"https://api.github.com/repos/eigenfoo/pymc3/commits{/sha}","git_commits_url":"https://api.github.com/repos/eigenfoo/pymc3/git/commits{/sha}","comments_url":"https://api.github.com/repos/eigenfoo/pymc3/comments{/number}","issue_comment_url":"https://api.github.com/repos/eigenfoo/pymc3/issues/comments{/number}","contents_url":"https://api.github.com/repos/eigenfoo/pymc3/contents/{+path}","compare_url":"https://api.github.com/repos/eigenfoo/pymc3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eigenfoo/pymc3/merges","archive_url":"https://api.github.com/repos/eigenfoo/pymc3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eigenfoo/pymc3/downloads","issues_url":"https://api.github.com/repos/eigenfoo/pymc3/issues{/number}","pulls_url":"https://api.github.com/repos/eigenfoo/pymc3/pulls{/number}","milestones_url":"https://api.github.com/repos/eigenfoo/pymc3/milestones{/number}","notifications_url":"https://api.github.com/repos/eigenfoo/pymc3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eigenfoo/pymc3/labels{/name}","releases_url":"https://api.github.com/repos/eigenfoo/pymc3/releases{/id}","deployments_url":"https://api.github.com/repos/eigenfoo/pymc3/deployments","created_at":"2018-07-18T20:45:18Z","updated_at":"2018-07-18T20:45:21Z","pushed_at":"2018-07-18T22:08:15Z","git_url":"git://github.com/eigenfoo/pymc3.git","ssh_url":"git@github.com:eigenfoo/pymc3.git","clone_url":"https://github.com/eigenfoo/pymc3.git","svn_url":"https://github.com/eigenfoo/pymc3","homepage":"http://pymc-devs.github.io/pymc3/","size":233685,"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,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pymc-devs:master","ref":"master","sha":"fc2bb564b614f3c610035358c2e72e58a9bc605b","user":{"login":"pymc-devs","id":81121,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgxMTIx","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,"node_id":"MDEwOlJlcG9zaXRvcnkxOTI5MDQ=","name":"pymc3","full_name":"pymc-devs/pymc3","owner":{"login":"pymc-devs","id":81121,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgxMTIx","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":"2018-07-19T14:24:11Z","pushed_at":"2018-07-19T03:43:49Z","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":233666,"stargazers_count":3462,"watchers_count":3462,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":855,"mirror_url":null,"archived":false,"open_issues_count":261,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":855,"open_issues":261,"watchers":3462,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/3106"},"html":{"href":"https://github.com/pymc-devs/pymc3/pull/3106"},"issue":{"href":"https://api.github.com/repos/pymc-devs/pymc3/issues/3106"},"comments":{"href":"https://api.github.com/repos/pymc-devs/pymc3/issues/3106/comments"},"review_comments":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/3106/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/3106/commits"},"statuses":{"href":"https://api.github.com/repos/pymc-devs/pymc3/statuses/ccf5c933a4bbf496505766f980578184ecfa0110"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"fonnesbeck"}}