{"action":"created","comment":{"url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/comments/56691114","id":56691114,"diff_hunk":"@@ -1113,3 +1113,43 @@ def logp(self, value):\n                       - T.log(sigma * T.sqrt(2 * np.pi))\n                       - 0.5 * ((value - mu) / sigma)**2)\n         return bound(lp, sigma > 0., nu > 0.)\n+\n+\n+class VonMises(Continuous):\n+    R\"\"\"\n+    Univariate VonMises log-likelihood.\n+    .. math::\n+        f(x \\mid \\mu, \\kappa) =  \n+            \\frac{e^{\\kappa\\cos(x-\\mu)}}{2\\pi I_0(\\kappa)}\n+             \n+    where :I_0 is the modified Bessel function of order 0.\n+    \n+    ========  ==========================================\n+    Support   :math:`x \\in [-\\pi, \\pi]`\n+    Mean      :math:`\\mu`\n+    Variance  :math:`\\frac{1-I1(\\kappa)}{I0(\\kappa)}`\n+    ========  ==========================================\n+    Parameters\n+    ----------\n+    mu : float\n+        Mean.\n+    kappa : float\n+        Concentration (\\frac{1}{kappa} is analogous to \\sigma^2).\n+    \"\"\"\n+    def __init__(self, mu=0.0, kappa=None, *args, **kwargs):\n+        super(VonMises, self).__init__(*args, **kwargs)\n+        self.mean = self.median = self.mode = self.mu = mu\n+        self.kappa = kappa \n+        self.variance = 1. - special.i1(self.kappa) / special.i0(self.kappa)","path":"pymc3/distributions/continuous.py","position":49,"original_position":49,"commit_id":"0cfa42890763a8ba110776787206c27cd6e3783a","original_commit_id":"0cfa42890763a8ba110776787206c27cd6e3783a","user":{"login":"aloctavodia","id":1338958,"avatar_url":"https://avatars.githubusercontent.com/u/1338958?v=3","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":"I thought the same at first. But I am not getting any errors. Theano only have ```j0``` and  ```j1```.","created_at":"2016-03-18T17:20:15Z","updated_at":"2016-03-18T17:20:15Z","html_url":"https://github.com/pymc-devs/pymc3/pull/1022#discussion_r56691114","pull_request_url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/1022","_links":{"self":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/comments/56691114"},"html":{"href":"https://github.com/pymc-devs/pymc3/pull/1022#discussion_r56691114"},"pull_request":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/1022"}}},"pull_request":{"url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/1022","id":63372546,"html_url":"https://github.com/pymc-devs/pymc3/pull/1022","diff_url":"https://github.com/pymc-devs/pymc3/pull/1022.diff","patch_url":"https://github.com/pymc-devs/pymc3/pull/1022.patch","issue_url":"https://api.github.com/repos/pymc-devs/pymc3/issues/1022","number":1022,"state":"open","locked":false,"title":"add vonmises distribution and tests","user":{"login":"aloctavodia","id":1338958,"avatar_url":"https://avatars.githubusercontent.com/u/1338958?v=3","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":"I have implemented the [von Mises](https://en.wikipedia.org/wiki/Von_Mises_distribution), is similar to a gaussian distribution but defined on the circle, i.e. ```[-pi, pi]```. \r\n\r\nI am not sure about the tests, I just tried to implement tests similar to those for other distributions.\r\n\r\nBased on comparison with ```scipy.stats.vonmises``` I think the distribution is working correctly, in general. Although, some artifacts appear if you sample a von Mises close to ```+-pi```. Since ```-pi``` and ```pi``` are really the same number (and the variable is restricted to a circular space) the density for these points should be the same. In practice, they differ and the magnitude of the difference decrease with the sample size. I guess this could improved if a transformation is applied to take into account the circularity of the variable. I will explore this idea further, in the next few days.","created_at":"2016-03-18T13:17:36Z","updated_at":"2016-03-18T17:20:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6783d502889d2d350e47ec1aaac1a33abbca077e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/1022/commits","review_comments_url":"https://api.github.com/repos/pymc-devs/pymc3/pulls/1022/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/1022/comments","statuses_url":"https://api.github.com/repos/pymc-devs/pymc3/statuses/0cfa42890763a8ba110776787206c27cd6e3783a","head":{"label":"aloctavodia:master","ref":"master","sha":"0cfa42890763a8ba110776787206c27cd6e3783a","user":{"login":"aloctavodia","id":1338958,"avatar_url":"https://avatars.githubusercontent.com/u/1338958?v=3","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},"repo":{"id":47996917,"name":"pymc3","full_name":"aloctavodia/pymc3","owner":{"login":"aloctavodia","id":1338958,"avatar_url":"https://avatars.githubusercontent.com/u/1338958?v=3","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},"private":false,"html_url":"https://github.com/aloctavodia/pymc3","description":"PyMC version 3","fork":true,"url":"https://api.github.com/repos/aloctavodia/pymc3","forks_url":"https://api.github.com/repos/aloctavodia/pymc3/forks","keys_url":"https://api.github.com/repos/aloctavodia/pymc3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aloctavodia/pymc3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aloctavodia/pymc3/teams","hooks_url":"https://api.github.com/repos/aloctavodia/pymc3/hooks","issue_events_url":"https://api.github.com/repos/aloctavodia/pymc3/issues/events{/number}","events_url":"https://api.github.com/repos/aloctavodia/pymc3/events","assignees_url":"https://api.github.com/repos/aloctavodia/pymc3/assignees{/user}","branches_url":"https://api.github.com/repos/aloctavodia/pymc3/branches{/branch}","tags_url":"https://api.github.com/repos/aloctavodia/pymc3/tags","blobs_url":"https://api.github.com/repos/aloctavodia/pymc3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aloctavodia/pymc3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aloctavodia/pymc3/git/refs{/sha}","trees_url":"https://api.github.com/repos/aloctavodia/pymc3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aloctavodia/pymc3/statuses/{sha}","languages_url":"https://api.github.com/repos/aloctavodia/pymc3/languages","stargazers_url":"https://api.github.com/repos/aloctavodia/pymc3/stargazers","contributors_url":"https://api.github.com/repos/aloctavodia/pymc3/contributors","subscribers_url":"https://api.github.com/repos/aloctavodia/pymc3/subscribers","subscription_url":"https://api.github.com/repos/aloctavodia/pymc3/subscription","commits_url":"https://api.github.com/repos/aloctavodia/pymc3/commits{/sha}","git_commits_url":"https://api.github.com/repos/aloctavodia/pymc3/git/commits{/sha}","comments_url":"https://api.github.com/repos/aloctavodia/pymc3/comments{/number}","issue_comment_url":"https://api.github.com/repos/aloctavodia/pymc3/issues/comments{/number}","contents_url":"https://api.github.com/repos/aloctavodia/pymc3/contents/{+path}","compare_url":"https://api.github.com/repos/aloctavodia/pymc3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aloctavodia/pymc3/merges","archive_url":"https://api.github.com/repos/aloctavodia/pymc3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aloctavodia/pymc3/downloads","issues_url":"https://api.github.com/repos/aloctavodia/pymc3/issues{/number}","pulls_url":"https://api.github.com/repos/aloctavodia/pymc3/pulls{/number}","milestones_url":"https://api.github.com/repos/aloctavodia/pymc3/milestones{/number}","notifications_url":"https://api.github.com/repos/aloctavodia/pymc3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aloctavodia/pymc3/labels{/name}","releases_url":"https://api.github.com/repos/aloctavodia/pymc3/releases{/id}","deployments_url":"https://api.github.com/repos/aloctavodia/pymc3/deployments","created_at":"2015-12-14T19:35:50Z","updated_at":"2016-01-26T15:11:49Z","pushed_at":"2016-03-18T12:46:26Z","git_url":"git://github.com/aloctavodia/pymc3.git","ssh_url":"git@github.com:aloctavodia/pymc3.git","clone_url":"https://github.com/aloctavodia/pymc3.git","svn_url":"https://github.com/aloctavodia/pymc3","homepage":"","size":66172,"stargazers_count":0,"watchers_count":0,"language":"Jupyter Notebook","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":0,"default_branch":"master"}},"base":{"label":"pymc-devs:master","ref":"master","sha":"f9de16e78c0116a8236611eeb1e840ecec67f41b","user":{"login":"pymc-devs","id":81121,"avatar_url":"https://avatars.githubusercontent.com/u/81121?v=3","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://avatars.githubusercontent.com/u/81121?v=3","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. Uses Theano as a backend and includes the NUTS sampler.","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":"2016-03-18T02:39:48Z","pushed_at":"2016-03-18T15:37:25Z","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":81132,"stargazers_count":1364,"watchers_count":1364,"language":"Jupyter Notebook","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":300,"mirror_url":null,"open_issues_count":129,"forks":300,"open_issues":129,"watchers":1364,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/1022"},"html":{"href":"https://github.com/pymc-devs/pymc3/pull/1022"},"issue":{"href":"https://api.github.com/repos/pymc-devs/pymc3/issues/1022"},"comments":{"href":"https://api.github.com/repos/pymc-devs/pymc3/issues/1022/comments"},"review_comments":{"href":"https://api.github.com/repos/pymc-devs/pymc3/pulls/1022/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/1022/commits"},"statuses":{"href":"https://api.github.com/repos/pymc-devs/pymc3/statuses/0cfa42890763a8ba110776787206c27cd6e3783a"}}}}