Skip to content

Use a more robust approach to static shape inference in Dirichlet #4061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

brandonwillard
Copy link
Contributor

@brandonwillard brandonwillard commented Aug 21, 2020

This PR adjusts the way that static shapes are obtained in the Dirichlet constructor. Previously, in some cases Theano wouldn't properly compute test values for the tt.shape(a) graph. This adjustment simply uses the test value of the a parameter instead.

It doesn't completely finish #4060, because pm.Dirichlet.dist(np.r_[1, 1]).random(size=2) still returns [1., 1.].

@brandonwillard brandonwillard self-assigned this Aug 21, 2020
@codecov
Copy link

codecov bot commented Aug 21, 2020

Codecov Report

Merging #4061 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4061   +/-   ##
=======================================
  Coverage   86.83%   86.83%           
=======================================
  Files          88       88           
  Lines       14165    14165           
=======================================
  Hits        12300    12300           
  Misses       1865     1865           
Impacted Files Coverage Δ
pymc3/distributions/multivariate.py 78.17% <100.00%> (ø)

Copy link
Contributor

@AlexAndorra AlexAndorra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @brandonwillard !
Out of curiosity, what do you expect pm.Dirichlet.dist(np.r_[1, 1]).random(size=2) to return? Something like [[0.5, 0.5], [0.4, 0.6]] for instance?

@brandonwillard brandonwillard merged commit 7e57248 into pymc-devs:master Sep 1, 2020
@brandonwillard brandonwillard deleted the fix-dirichlet-static-shape-inference branch September 1, 2020 20:28
@brandonwillard
Copy link
Contributor Author

LGTM, thanks @brandonwillard !
Out of curiosity, what do you expect pm.Dirichlet.dist(np.r_[1, 1]).random(size=2) to return? Something like [[0.5, 0.5], [0.4, 0.6]] for instance?

Yeah, that would be acceptable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants