{"action":"created","comment":{"url":"https://api.github.com/repos/scipy/scipy/pulls/comments/33016184","id":33016184,"diff_hunk":"@@ -363,6 +364,86 @@ def test_frozen_dirichlet(self):\n             assert_equal(d.pdf(x[:-1]), dirichlet.pdf(x[:-1], alpha))\n             assert_equal(d.logpdf(x[:-1]), dirichlet.logpdf(x[:-1], alpha))\n \n+    def test_numpy_rvs_shape_compatibility(self):\n+        np.random.seed(2846)\n+        alpha = np.array([1.0, 2.0, 3.0])\n+        x = np.random.dirichlet(alpha, size=7)\n+        assert_equal(x.shape, (7, 3))\n+        assert_raises(ValueError, dirichlet.pdf, x, alpha)\n+        assert_raises(ValueError, dirichlet.logpdf, x, alpha)\n+        dirichlet.pdf(x.T, alpha)\n+        dirichlet.pdf(x.T[:-1], alpha)\n+        dirichlet.logpdf(x.T, alpha)\n+        dirichlet.logpdf(x.T[:-1], alpha)","path":"scipy/stats/tests/test_multivariate.py","position":22,"original_position":22,"commit_id":"6afec70cf6386c560d88dbbb3e5234074d7c6a6c","original_commit_id":"6afec70cf6386c560d88dbbb3e5234074d7c6a6c","user":{"login":"hildensia","id":86228,"avatar_url":"https://avatars.githubusercontent.com/u/86228?v=3","gravatar_id":"","url":"https://api.github.com/users/hildensia","html_url":"https://github.com/hildensia","followers_url":"https://api.github.com/users/hildensia/followers","following_url":"https://api.github.com/users/hildensia/following{/other_user}","gists_url":"https://api.github.com/users/hildensia/gists{/gist_id}","starred_url":"https://api.github.com/users/hildensia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hildensia/subscriptions","organizations_url":"https://api.github.com/users/hildensia/orgs","repos_url":"https://api.github.com/users/hildensia/repos","events_url":"https://api.github.com/users/hildensia/events{/privacy}","received_events_url":"https://api.github.com/users/hildensia/received_events","type":"User","site_admin":false},"body":"This should be made to conform to numpy. Given that it's still a quite young scipy feature I'm in favor of a backwards incompatibility. How about something like:\n\ndef pdf(x, transposed_results=True):\n    if transposed_results:\n        raise SomeMeaningfulWarning(\"The default behavior of Dirichlet.pdf() will change in 0.17.0. Check the documentation. \")\n    ...\n-- \nSent from my mobile device. Please excuse my brevity and typos.\n\nOn June 23, 2015 7:42:50 AM GMT+02:00, Ralf Gommers <notifications@github.com> wrote:\n>> @@ -363,6 +364,86 @@ def test_frozen_dirichlet(self):\n>>              assert_equal(d.pdf(x[:-1]), dirichlet.pdf(x[:-1],\n>alpha))\n>>              assert_equal(d.logpdf(x[:-1]), dirichlet.logpdf(x[:-1],\n>alpha))\n>>  \n>> +    def test_numpy_rvs_shape_compatibility(self):\n>> +        np.random.seed(2846)\n>> +        alpha = np.array([1.0, 2.0, 3.0])\n>> +        x = np.random.dirichlet(alpha, size=7)\n>> +        assert_equal(x.shape, (7, 3))\n>> +        assert_raises(ValueError, dirichlet.pdf, x, alpha)\n>> +        assert_raises(ValueError, dirichlet.logpdf, x, alpha)\n>> +        dirichlet.pdf(x.T, alpha)\n>> +        dirichlet.pdf(x.T[:-1], alpha)\n>> +        dirichlet.logpdf(x.T, alpha)\n>> +        dirichlet.logpdf(x.T[:-1], alpha)\n>\n>\n>\n> > >   could the rvs be incompatibly changed like numpy/numpy#5872?\n>\n>> This sounds like something the random_state arg be useful for.\n>\n>Better to add a new keyword if needed I think. Overloading\n>``random_state`` to take inputs other than a seed or ``RandomState``\n>instance makes it inconsistent with all other ``random_state`` keywords\n>in the rest of the module.\n>\n>---\n>Reply to this email directly or view it on GitHub:\n>https://github.com/scipy/scipy/pull/4984/files#r33011011\n","created_at":"2015-06-23T07:35:50Z","updated_at":"2015-06-23T07:35:50Z","html_url":"https://github.com/scipy/scipy/pull/4984#discussion_r33016184","pull_request_url":"https://api.github.com/repos/scipy/scipy/pulls/4984","_links":{"self":{"href":"https://api.github.com/repos/scipy/scipy/pulls/comments/33016184"},"html":{"href":"https://github.com/scipy/scipy/pull/4984#discussion_r33016184"},"pull_request":{"href":"https://api.github.com/repos/scipy/scipy/pulls/4984"}}},"pull_request":{"url":"https://api.github.com/repos/scipy/scipy/pulls/4984","id":38264507,"html_url":"https://github.com/scipy/scipy/pull/4984","diff_url":"https://github.com/scipy/scipy/pull/4984.diff","patch_url":"https://github.com/scipy/scipy/pull/4984.patch","issue_url":"https://api.github.com/repos/scipy/scipy/issues/4984","number":4984,"state":"open","locked":false,"title":"clarify dirichlet distribution error handling","user":{"login":"argriffing","id":101416,"avatar_url":"https://avatars.githubusercontent.com/u/101416?v=3","gravatar_id":"","url":"https://api.github.com/users/argriffing","html_url":"https://github.com/argriffing","followers_url":"https://api.github.com/users/argriffing/followers","following_url":"https://api.github.com/users/argriffing/following{/other_user}","gists_url":"https://api.github.com/users/argriffing/gists{/gist_id}","starred_url":"https://api.github.com/users/argriffing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/argriffing/subscriptions","organizations_url":"https://api.github.com/users/argriffing/orgs","repos_url":"https://api.github.com/users/argriffing/repos","events_url":"https://api.github.com/users/argriffing/events{/privacy}","received_events_url":"https://api.github.com/users/argriffing/received_events","type":"User","site_admin":false},"body":"An inconsistency in the interface of the scipy dirichlet distribution is that if you sample some data using dirichlet.rvs or using np.random.dirichlet, the returned array needs to be transposed before computing dirichlet.pdf or dirichlet.logpdf.","created_at":"2015-06-22T19:02:13Z","updated_at":"2015-06-23T07:35:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29812175fbdba35b9bbea9298dc6f8c9733556a3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scipy/scipy/pulls/4984/commits","review_comments_url":"https://api.github.com/repos/scipy/scipy/pulls/4984/comments","review_comment_url":"https://api.github.com/repos/scipy/scipy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scipy/scipy/issues/4984/comments","statuses_url":"https://api.github.com/repos/scipy/scipy/statuses/6afec70cf6386c560d88dbbb3e5234074d7c6a6c","head":{"label":"argriffing:dirichlet-error-messages","ref":"dirichlet-error-messages","sha":"6afec70cf6386c560d88dbbb3e5234074d7c6a6c","user":{"login":"argriffing","id":101416,"avatar_url":"https://avatars.githubusercontent.com/u/101416?v=3","gravatar_id":"","url":"https://api.github.com/users/argriffing","html_url":"https://github.com/argriffing","followers_url":"https://api.github.com/users/argriffing/followers","following_url":"https://api.github.com/users/argriffing/following{/other_user}","gists_url":"https://api.github.com/users/argriffing/gists{/gist_id}","starred_url":"https://api.github.com/users/argriffing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/argriffing/subscriptions","organizations_url":"https://api.github.com/users/argriffing/orgs","repos_url":"https://api.github.com/users/argriffing/repos","events_url":"https://api.github.com/users/argriffing/events{/privacy}","received_events_url":"https://api.github.com/users/argriffing/received_events","type":"User","site_admin":false},"repo":{"id":9656293,"name":"scipy","full_name":"argriffing/scipy","owner":{"login":"argriffing","id":101416,"avatar_url":"https://avatars.githubusercontent.com/u/101416?v=3","gravatar_id":"","url":"https://api.github.com/users/argriffing","html_url":"https://github.com/argriffing","followers_url":"https://api.github.com/users/argriffing/followers","following_url":"https://api.github.com/users/argriffing/following{/other_user}","gists_url":"https://api.github.com/users/argriffing/gists{/gist_id}","starred_url":"https://api.github.com/users/argriffing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/argriffing/subscriptions","organizations_url":"https://api.github.com/users/argriffing/orgs","repos_url":"https://api.github.com/users/argriffing/repos","events_url":"https://api.github.com/users/argriffing/events{/privacy}","received_events_url":"https://api.github.com/users/argriffing/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/argriffing/scipy","description":"Scipy main repository","fork":true,"url":"https://api.github.com/repos/argriffing/scipy","forks_url":"https://api.github.com/repos/argriffing/scipy/forks","keys_url":"https://api.github.com/repos/argriffing/scipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/argriffing/scipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/argriffing/scipy/teams","hooks_url":"https://api.github.com/repos/argriffing/scipy/hooks","issue_events_url":"https://api.github.com/repos/argriffing/scipy/issues/events{/number}","events_url":"https://api.github.com/repos/argriffing/scipy/events","assignees_url":"https://api.github.com/repos/argriffing/scipy/assignees{/user}","branches_url":"https://api.github.com/repos/argriffing/scipy/branches{/branch}","tags_url":"https://api.github.com/repos/argriffing/scipy/tags","blobs_url":"https://api.github.com/repos/argriffing/scipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/argriffing/scipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/argriffing/scipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/argriffing/scipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/argriffing/scipy/statuses/{sha}","languages_url":"https://api.github.com/repos/argriffing/scipy/languages","stargazers_url":"https://api.github.com/repos/argriffing/scipy/stargazers","contributors_url":"https://api.github.com/repos/argriffing/scipy/contributors","subscribers_url":"https://api.github.com/repos/argriffing/scipy/subscribers","subscription_url":"https://api.github.com/repos/argriffing/scipy/subscription","commits_url":"https://api.github.com/repos/argriffing/scipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/argriffing/scipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/argriffing/scipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/argriffing/scipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/argriffing/scipy/contents/{+path}","compare_url":"https://api.github.com/repos/argriffing/scipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/argriffing/scipy/merges","archive_url":"https://api.github.com/repos/argriffing/scipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/argriffing/scipy/downloads","issues_url":"https://api.github.com/repos/argriffing/scipy/issues{/number}","pulls_url":"https://api.github.com/repos/argriffing/scipy/pulls{/number}","milestones_url":"https://api.github.com/repos/argriffing/scipy/milestones{/number}","notifications_url":"https://api.github.com/repos/argriffing/scipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/argriffing/scipy/labels{/name}","releases_url":"https://api.github.com/repos/argriffing/scipy/releases{/id}","created_at":"2013-04-24T19:49:17Z","updated_at":"2015-05-05T19:57:45Z","pushed_at":"2015-06-22T19:18:09Z","git_url":"git://github.com/argriffing/scipy.git","ssh_url":"git@github.com:argriffing/scipy.git","clone_url":"https://github.com/argriffing/scipy.git","svn_url":"https://github.com/argriffing/scipy","homepage":"http://scipy.org/","size":59698,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"scipy:master","ref":"master","sha":"a344c3f8f47571ca60c45670e74446035c0a7958","user":{"login":"scipy","id":288277,"avatar_url":"https://avatars.githubusercontent.com/u/288277?v=3","gravatar_id":"","url":"https://api.github.com/users/scipy","html_url":"https://github.com/scipy","followers_url":"https://api.github.com/users/scipy/followers","following_url":"https://api.github.com/users/scipy/following{/other_user}","gists_url":"https://api.github.com/users/scipy/gists{/gist_id}","starred_url":"https://api.github.com/users/scipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scipy/subscriptions","organizations_url":"https://api.github.com/users/scipy/orgs","repos_url":"https://api.github.com/users/scipy/repos","events_url":"https://api.github.com/users/scipy/events{/privacy}","received_events_url":"https://api.github.com/users/scipy/received_events","type":"Organization","site_admin":false},"repo":{"id":1460385,"name":"scipy","full_name":"scipy/scipy","owner":{"login":"scipy","id":288277,"avatar_url":"https://avatars.githubusercontent.com/u/288277?v=3","gravatar_id":"","url":"https://api.github.com/users/scipy","html_url":"https://github.com/scipy","followers_url":"https://api.github.com/users/scipy/followers","following_url":"https://api.github.com/users/scipy/following{/other_user}","gists_url":"https://api.github.com/users/scipy/gists{/gist_id}","starred_url":"https://api.github.com/users/scipy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scipy/subscriptions","organizations_url":"https://api.github.com/users/scipy/orgs","repos_url":"https://api.github.com/users/scipy/repos","events_url":"https://api.github.com/users/scipy/events{/privacy}","received_events_url":"https://api.github.com/users/scipy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scipy/scipy","description":"Scipy library main repository","fork":false,"url":"https://api.github.com/repos/scipy/scipy","forks_url":"https://api.github.com/repos/scipy/scipy/forks","keys_url":"https://api.github.com/repos/scipy/scipy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scipy/scipy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scipy/scipy/teams","hooks_url":"https://api.github.com/repos/scipy/scipy/hooks","issue_events_url":"https://api.github.com/repos/scipy/scipy/issues/events{/number}","events_url":"https://api.github.com/repos/scipy/scipy/events","assignees_url":"https://api.github.com/repos/scipy/scipy/assignees{/user}","branches_url":"https://api.github.com/repos/scipy/scipy/branches{/branch}","tags_url":"https://api.github.com/repos/scipy/scipy/tags","blobs_url":"https://api.github.com/repos/scipy/scipy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scipy/scipy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scipy/scipy/git/refs{/sha}","trees_url":"https://api.github.com/repos/scipy/scipy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scipy/scipy/statuses/{sha}","languages_url":"https://api.github.com/repos/scipy/scipy/languages","stargazers_url":"https://api.github.com/repos/scipy/scipy/stargazers","contributors_url":"https://api.github.com/repos/scipy/scipy/contributors","subscribers_url":"https://api.github.com/repos/scipy/scipy/subscribers","subscription_url":"https://api.github.com/repos/scipy/scipy/subscription","commits_url":"https://api.github.com/repos/scipy/scipy/commits{/sha}","git_commits_url":"https://api.github.com/repos/scipy/scipy/git/commits{/sha}","comments_url":"https://api.github.com/repos/scipy/scipy/comments{/number}","issue_comment_url":"https://api.github.com/repos/scipy/scipy/issues/comments{/number}","contents_url":"https://api.github.com/repos/scipy/scipy/contents/{+path}","compare_url":"https://api.github.com/repos/scipy/scipy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scipy/scipy/merges","archive_url":"https://api.github.com/repos/scipy/scipy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scipy/scipy/downloads","issues_url":"https://api.github.com/repos/scipy/scipy/issues{/number}","pulls_url":"https://api.github.com/repos/scipy/scipy/pulls{/number}","milestones_url":"https://api.github.com/repos/scipy/scipy/milestones{/number}","notifications_url":"https://api.github.com/repos/scipy/scipy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scipy/scipy/labels{/name}","releases_url":"https://api.github.com/repos/scipy/scipy/releases{/id}","created_at":"2011-03-09T18:52:03Z","updated_at":"2015-06-22T13:21:44Z","pushed_at":"2015-06-23T04:23:38Z","git_url":"git://github.com/scipy/scipy.git","ssh_url":"git@github.com:scipy/scipy.git","clone_url":"https://github.com/scipy/scipy.git","svn_url":"https://github.com/scipy/scipy","homepage":"http://scipy.org/scipylib/","size":88660,"stargazers_count":1690,"watchers_count":1690,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":930,"mirror_url":null,"open_issues_count":845,"forks":930,"open_issues":845,"watchers":1690,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scipy/scipy/pulls/4984"},"html":{"href":"https://github.com/scipy/scipy/pull/4984"},"issue":{"href":"https://api.github.com/repos/scipy/scipy/issues/4984"},"comments":{"href":"https://api.github.com/repos/scipy/scipy/issues/4984/comments"},"review_comments":{"href":"https://api.github.com/repos/scipy/scipy/pulls/4984/comments"},"review_comment":{"href":"https://api.github.com/repos/scipy/scipy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scipy/scipy/pulls/4984/commits"},"statuses":{"href":"https://api.github.com/repos/scipy/scipy/statuses/6afec70cf6386c560d88dbbb3e5234074d7c6a6c"}}}}