{"action":"created","comment":{"url":"https://api.github.com/repos/amzn/MXFusion/pulls/comments/225924755","pull_request_review_id":165625512,"id":225924755,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNTkyNDc1NQ==","diff_hunk":"@@ -0,0 +1,264 @@\n+import numpy as np\n+import mxnet as mx\n+\n+from mxfusion.common.exceptions import InferenceError\n+from ...util import special as sp\n+from ...common.config import get_default_MXNet_mode\n+from ..variables import Variable\n+from .distribution import Distribution, LogPDFDecorator, DrawSamplesDecorator\n+from ..variables import is_sampled_array, get_num_samples\n+from ...util.customop import broadcast_to_w_samples\n+\n+\n+class WishartLogPDFDecorator(LogPDFDecorator):\n+\n+    def _wrap_log_pdf_with_broadcast(self, func):\n+        def log_pdf_broadcast(self, F, **kw):\n+            \"\"\"\n+            Computes the logarithm of the probability density/mass function (PDF/PMF) of the distribution.\n+            The inputs and outputs variables are in RTVariable format.\n+\n+            Shape assumptions:\n+            * degrees_of_freedom is S x 1\n+            * scale is S x N x D x D\n+            * random_variable is S x N x D x D\n+\n+            Where:\n+            * S, the number of samples, is optional. If more than one of the variables has samples,\n+            the number of samples in each variable must be the same. S is 1 by default if not a sampled variable.\n+            * N is the number of data points. N can be any number of dimensions (N_1, N_2, ...) but must be\n+             broadcastable to the shape of random_variable.\n+            * D is the dimension of the distribution.\n+\n+            :param F: the MXNet computation mode (mxnet.symbol or mxnet.ndarray)\n+            :param kw: the dict of input and output variables of the distribution\n+            :type kw: {str (name): MXNet NDArray or MXNet Symbol}\n+            :returns: log pdf of the distribution\n+            :rtypes: MXNet NDArray or MXNet Symbol\n+            \"\"\"\n+            variables = {name: kw[name] for name, _ in self.inputs}\n+            variables['random_variable'] = kw['random_variable']\n+            rv_shape = variables['random_variable'].shape[1:]\n+\n+            num_samples = max([get_num_samples(F, v) for v in variables.values()])\n+\n+            shapes_map = dict(\n+                degrees_of_freedom=(num_samples,),\n+                scale=(num_samples,) + rv_shape,\n+                random_variable=(num_samples,) + rv_shape\n+            )\n+            variables = {name: broadcast_to_w_samples(F, v, shapes_map[name])\n+                         for name, v in variables.items()}\n+            res = func(self, F=F, **variables)\n+            return res\n+        return log_pdf_broadcast\n+\n+\n+class WishartDrawSamplesDecorator(DrawSamplesDecorator):\n+\n+    def _wrap_draw_samples_with_broadcast(self, func):\n+        def draw_samples_broadcast(self, F, rv_shape, num_samples=1,\n+                                   always_return_tuple=False, **kw):\n+            \"\"\"\n+            Draw a number of samples from the distribution. The inputs and outputs variables are in RTVariable format.","path":"mxfusion/components/distributions/wishart.py","position":63,"original_position":63,"commit_id":"bc406572bc559eab9c199fc07e7ac4f3025875bb","original_commit_id":"bc406572bc559eab9c199fc07e7ac4f3025875bb","user":{"login":"meissnereric","id":6857699,"node_id":"MDQ6VXNlcjY4NTc2OTk=","avatar_url":"https://avatars1.githubusercontent.com/u/6857699?v=4","gravatar_id":"","url":"https://api.github.com/users/meissnereric","html_url":"https://github.com/meissnereric","followers_url":"https://api.github.com/users/meissnereric/followers","following_url":"https://api.github.com/users/meissnereric/following{/other_user}","gists_url":"https://api.github.com/users/meissnereric/gists{/gist_id}","starred_url":"https://api.github.com/users/meissnereric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meissnereric/subscriptions","organizations_url":"https://api.github.com/users/meissnereric/orgs","repos_url":"https://api.github.com/users/meissnereric/repos","events_url":"https://api.github.com/users/meissnereric/events{/privacy}","received_events_url":"https://api.github.com/users/meissnereric/received_events","type":"User","site_admin":false},"body":"```suggestion\r\n            Draw a number of samples from the distribution.\r\n```\r\n\r\nI know you didn't write this, but could you change this comment in the other shape decorators to not refer to RTVariables? That's an old concept we got rid of a while back.","created_at":"2018-10-17T13:21:41Z","updated_at":"2018-10-17T13:29:07Z","html_url":"https://github.com/amzn/MXFusion/pull/49#discussion_r225924755","pull_request_url":"https://api.github.com/repos/amzn/MXFusion/pulls/49","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/amzn/MXFusion/pulls/comments/225924755"},"html":{"href":"https://github.com/amzn/MXFusion/pull/49#discussion_r225924755"},"pull_request":{"href":"https://api.github.com/repos/amzn/MXFusion/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/amzn/MXFusion/pulls/49","id":223558310,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzNTU4MzEw","html_url":"https://github.com/amzn/MXFusion/pull/49","diff_url":"https://github.com/amzn/MXFusion/pull/49.diff","patch_url":"https://github.com/amzn/MXFusion/pull/49.patch","issue_url":"https://api.github.com/repos/amzn/MXFusion/issues/49","number":49,"state":"open","locked":false,"title":"Beta distribution","user":{"login":"tdiethe","id":1110560,"node_id":"MDQ6VXNlcjExMTA1NjA=","avatar_url":"https://avatars0.githubusercontent.com/u/1110560?v=4","gravatar_id":"","url":"https://api.github.com/users/tdiethe","html_url":"https://github.com/tdiethe","followers_url":"https://api.github.com/users/tdiethe/followers","following_url":"https://api.github.com/users/tdiethe/following{/other_user}","gists_url":"https://api.github.com/users/tdiethe/gists{/gist_id}","starred_url":"https://api.github.com/users/tdiethe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdiethe/subscriptions","organizations_url":"https://api.github.com/users/tdiethe/orgs","repos_url":"https://api.github.com/users/tdiethe/repos","events_url":"https://api.github.com/users/tdiethe/events{/privacy}","received_events_url":"https://api.github.com/users/tdiethe/received_events","type":"User","site_admin":false},"body":"*Issue #, if available:*\r\n\r\n*Description of changes:*\r\n\r\nAdded beta distribution (with unit tests)\r\n\r\nBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.\r\n","created_at":"2018-10-17T11:00:23Z","updated_at":"2018-10-17T13:29:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ed396163845ffd4129a203fc17a348583773b22","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/amzn/MXFusion/pulls/49/commits","review_comments_url":"https://api.github.com/repos/amzn/MXFusion/pulls/49/comments","review_comment_url":"https://api.github.com/repos/amzn/MXFusion/pulls/comments{/number}","comments_url":"https://api.github.com/repos/amzn/MXFusion/issues/49/comments","statuses_url":"https://api.github.com/repos/amzn/MXFusion/statuses/bc406572bc559eab9c199fc07e7ac4f3025875bb","head":{"label":"tdiethe:beta","ref":"beta","sha":"bc406572bc559eab9c199fc07e7ac4f3025875bb","user":{"login":"tdiethe","id":1110560,"node_id":"MDQ6VXNlcjExMTA1NjA=","avatar_url":"https://avatars0.githubusercontent.com/u/1110560?v=4","gravatar_id":"","url":"https://api.github.com/users/tdiethe","html_url":"https://github.com/tdiethe","followers_url":"https://api.github.com/users/tdiethe/followers","following_url":"https://api.github.com/users/tdiethe/following{/other_user}","gists_url":"https://api.github.com/users/tdiethe/gists{/gist_id}","starred_url":"https://api.github.com/users/tdiethe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdiethe/subscriptions","organizations_url":"https://api.github.com/users/tdiethe/orgs","repos_url":"https://api.github.com/users/tdiethe/repos","events_url":"https://api.github.com/users/tdiethe/events{/privacy}","received_events_url":"https://api.github.com/users/tdiethe/received_events","type":"User","site_admin":false},"repo":{"id":152578357,"node_id":"MDEwOlJlcG9zaXRvcnkxNTI1NzgzNTc=","name":"MXFusion","full_name":"tdiethe/MXFusion","private":false,"owner":{"login":"tdiethe","id":1110560,"node_id":"MDQ6VXNlcjExMTA1NjA=","avatar_url":"https://avatars0.githubusercontent.com/u/1110560?v=4","gravatar_id":"","url":"https://api.github.com/users/tdiethe","html_url":"https://github.com/tdiethe","followers_url":"https://api.github.com/users/tdiethe/followers","following_url":"https://api.github.com/users/tdiethe/following{/other_user}","gists_url":"https://api.github.com/users/tdiethe/gists{/gist_id}","starred_url":"https://api.github.com/users/tdiethe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdiethe/subscriptions","organizations_url":"https://api.github.com/users/tdiethe/orgs","repos_url":"https://api.github.com/users/tdiethe/repos","events_url":"https://api.github.com/users/tdiethe/events{/privacy}","received_events_url":"https://api.github.com/users/tdiethe/received_events","type":"User","site_admin":false},"html_url":"https://github.com/tdiethe/MXFusion","description":"Modular Probabilistic Programming on MXNet","fork":true,"url":"https://api.github.com/repos/tdiethe/MXFusion","forks_url":"https://api.github.com/repos/tdiethe/MXFusion/forks","keys_url":"https://api.github.com/repos/tdiethe/MXFusion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tdiethe/MXFusion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tdiethe/MXFusion/teams","hooks_url":"https://api.github.com/repos/tdiethe/MXFusion/hooks","issue_events_url":"https://api.github.com/repos/tdiethe/MXFusion/issues/events{/number}","events_url":"https://api.github.com/repos/tdiethe/MXFusion/events","assignees_url":"https://api.github.com/repos/tdiethe/MXFusion/assignees{/user}","branches_url":"https://api.github.com/repos/tdiethe/MXFusion/branches{/branch}","tags_url":"https://api.github.com/repos/tdiethe/MXFusion/tags","blobs_url":"https://api.github.com/repos/tdiethe/MXFusion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tdiethe/MXFusion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tdiethe/MXFusion/git/refs{/sha}","trees_url":"https://api.github.com/repos/tdiethe/MXFusion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tdiethe/MXFusion/statuses/{sha}","languages_url":"https://api.github.com/repos/tdiethe/MXFusion/languages","stargazers_url":"https://api.github.com/repos/tdiethe/MXFusion/stargazers","contributors_url":"https://api.github.com/repos/tdiethe/MXFusion/contributors","subscribers_url":"https://api.github.com/repos/tdiethe/MXFusion/subscribers","subscription_url":"https://api.github.com/repos/tdiethe/MXFusion/subscription","commits_url":"https://api.github.com/repos/tdiethe/MXFusion/commits{/sha}","git_commits_url":"https://api.github.com/repos/tdiethe/MXFusion/git/commits{/sha}","comments_url":"https://api.github.com/repos/tdiethe/MXFusion/comments{/number}","issue_comment_url":"https://api.github.com/repos/tdiethe/MXFusion/issues/comments{/number}","contents_url":"https://api.github.com/repos/tdiethe/MXFusion/contents/{+path}","compare_url":"https://api.github.com/repos/tdiethe/MXFusion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tdiethe/MXFusion/merges","archive_url":"https://api.github.com/repos/tdiethe/MXFusion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tdiethe/MXFusion/downloads","issues_url":"https://api.github.com/repos/tdiethe/MXFusion/issues{/number}","pulls_url":"https://api.github.com/repos/tdiethe/MXFusion/pulls{/number}","milestones_url":"https://api.github.com/repos/tdiethe/MXFusion/milestones{/number}","notifications_url":"https://api.github.com/repos/tdiethe/MXFusion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tdiethe/MXFusion/labels{/name}","releases_url":"https://api.github.com/repos/tdiethe/MXFusion/releases{/id}","deployments_url":"https://api.github.com/repos/tdiethe/MXFusion/deployments","created_at":"2018-10-11T11:08:12Z","updated_at":"2018-10-16T09:08:26Z","pushed_at":"2018-10-17T10:59:13Z","git_url":"git://github.com/tdiethe/MXFusion.git","ssh_url":"git@github.com:tdiethe/MXFusion.git","clone_url":"https://github.com/tdiethe/MXFusion.git","svn_url":"https://github.com/tdiethe/MXFusion","homepage":"","size":614,"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":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"amzn:develop","ref":"develop","sha":"6e6c76be577a96c9e14bad29afba9c9cf230bbc9","user":{"login":"amzn","id":8594673,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1OTQ2NzM=","avatar_url":"https://avatars1.githubusercontent.com/u/8594673?v=4","gravatar_id":"","url":"https://api.github.com/users/amzn","html_url":"https://github.com/amzn","followers_url":"https://api.github.com/users/amzn/followers","following_url":"https://api.github.com/users/amzn/following{/other_user}","gists_url":"https://api.github.com/users/amzn/gists{/gist_id}","starred_url":"https://api.github.com/users/amzn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amzn/subscriptions","organizations_url":"https://api.github.com/users/amzn/orgs","repos_url":"https://api.github.com/users/amzn/repos","events_url":"https://api.github.com/users/amzn/events{/privacy}","received_events_url":"https://api.github.com/users/amzn/received_events","type":"Organization","site_admin":false},"repo":{"id":143047851,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMwNDc4NTE=","name":"MXFusion","full_name":"amzn/MXFusion","private":false,"owner":{"login":"amzn","id":8594673,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg1OTQ2NzM=","avatar_url":"https://avatars1.githubusercontent.com/u/8594673?v=4","gravatar_id":"","url":"https://api.github.com/users/amzn","html_url":"https://github.com/amzn","followers_url":"https://api.github.com/users/amzn/followers","following_url":"https://api.github.com/users/amzn/following{/other_user}","gists_url":"https://api.github.com/users/amzn/gists{/gist_id}","starred_url":"https://api.github.com/users/amzn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amzn/subscriptions","organizations_url":"https://api.github.com/users/amzn/orgs","repos_url":"https://api.github.com/users/amzn/repos","events_url":"https://api.github.com/users/amzn/events{/privacy}","received_events_url":"https://api.github.com/users/amzn/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/amzn/MXFusion","description":"Modular Probabilistic Programming on MXNet","fork":false,"url":"https://api.github.com/repos/amzn/MXFusion","forks_url":"https://api.github.com/repos/amzn/MXFusion/forks","keys_url":"https://api.github.com/repos/amzn/MXFusion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amzn/MXFusion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amzn/MXFusion/teams","hooks_url":"https://api.github.com/repos/amzn/MXFusion/hooks","issue_events_url":"https://api.github.com/repos/amzn/MXFusion/issues/events{/number}","events_url":"https://api.github.com/repos/amzn/MXFusion/events","assignees_url":"https://api.github.com/repos/amzn/MXFusion/assignees{/user}","branches_url":"https://api.github.com/repos/amzn/MXFusion/branches{/branch}","tags_url":"https://api.github.com/repos/amzn/MXFusion/tags","blobs_url":"https://api.github.com/repos/amzn/MXFusion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amzn/MXFusion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amzn/MXFusion/git/refs{/sha}","trees_url":"https://api.github.com/repos/amzn/MXFusion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amzn/MXFusion/statuses/{sha}","languages_url":"https://api.github.com/repos/amzn/MXFusion/languages","stargazers_url":"https://api.github.com/repos/amzn/MXFusion/stargazers","contributors_url":"https://api.github.com/repos/amzn/MXFusion/contributors","subscribers_url":"https://api.github.com/repos/amzn/MXFusion/subscribers","subscription_url":"https://api.github.com/repos/amzn/MXFusion/subscription","commits_url":"https://api.github.com/repos/amzn/MXFusion/commits{/sha}","git_commits_url":"https://api.github.com/repos/amzn/MXFusion/git/commits{/sha}","comments_url":"https://api.github.com/repos/amzn/MXFusion/comments{/number}","issue_comment_url":"https://api.github.com/repos/amzn/MXFusion/issues/comments{/number}","contents_url":"https://api.github.com/repos/amzn/MXFusion/contents/{+path}","compare_url":"https://api.github.com/repos/amzn/MXFusion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amzn/MXFusion/merges","archive_url":"https://api.github.com/repos/amzn/MXFusion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amzn/MXFusion/downloads","issues_url":"https://api.github.com/repos/amzn/MXFusion/issues{/number}","pulls_url":"https://api.github.com/repos/amzn/MXFusion/pulls{/number}","milestones_url":"https://api.github.com/repos/amzn/MXFusion/milestones{/number}","notifications_url":"https://api.github.com/repos/amzn/MXFusion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amzn/MXFusion/labels{/name}","releases_url":"https://api.github.com/repos/amzn/MXFusion/releases{/id}","deployments_url":"https://api.github.com/repos/amzn/MXFusion/deployments","created_at":"2018-07-31T17:47:44Z","updated_at":"2018-10-17T08:40:18Z","pushed_at":"2018-10-17T11:00:24Z","git_url":"git://github.com/amzn/MXFusion.git","ssh_url":"git@github.com:amzn/MXFusion.git","clone_url":"https://github.com/amzn/MXFusion.git","svn_url":"https://github.com/amzn/MXFusion","homepage":"","size":611,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":20,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":7,"open_issues":20,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/amzn/MXFusion/pulls/49"},"html":{"href":"https://github.com/amzn/MXFusion/pull/49"},"issue":{"href":"https://api.github.com/repos/amzn/MXFusion/issues/49"},"comments":{"href":"https://api.github.com/repos/amzn/MXFusion/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/amzn/MXFusion/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/amzn/MXFusion/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/amzn/MXFusion/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/amzn/MXFusion/statuses/bc406572bc559eab9c199fc07e7ac4f3025875bb"}},"author_association":"NONE"}}
{"actor":{"display_login":"meissnereric"}}