Skip to content

Implement Dirichlet and Beta distributions#28

Closed
fritzo wants to merge 24 commits intogamma-reparameterizedfrom
dirichlet
Closed

Implement Dirichlet and Beta distributions#28
fritzo wants to merge 24 commits intogamma-reparameterizedfrom
dirichlet

Conversation

@fritzo
Copy link
Copy Markdown

@fritzo fritzo commented Nov 30, 2017

Based on pytorch#3978
DO NOT MERGE This PR will be moved to pytorch/pytorch.

This Implements reparameterized Dirichlet and Beta distributions with zero-variance gradients. The samplers useGamma.sample() and the reparameterized gradients are computed with similar numerical approximations. The approximation currently has bias under 2.5% relative error for a wide range of parameters (and rms relative error well below 0.5%); while this is above machine tolerance, it is much lower error than the high-variance stochastic version based on Gamma.sample().

For details of the derivation, see this Jupyter Notebook.

Accuracy of this zero-variance version

Details

beta-reparameterized

Accuracy of older stochastic version

Details

beta-reparameterized

@fritzo fritzo added WIP and removed awaiting review labels Dec 2, 2017
@fritzo fritzo added awaiting review and removed WIP labels Dec 2, 2017
Comment thread aten/src/TH/generic/THTensorMath.c Outdated
x = THTensor_(newContiguous)(x);
alpha = THTensor_(newContiguous)(alpha);
total = THTensor_(newContiguous)(total);
// FIXME these lines cause a linker error:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@apaszke Any idea why these macros would cause a linker error? They were fine before I moved to THTensorMath.c.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hard to say. For some reason the macro doesn't seem to be defined in this point, so it gets treated as an implicit declaration of a function (you're probably getting some warnings for this)

@fritzo
Copy link
Copy Markdown
Author

fritzo commented Dec 11, 2017

Moved to pytorch#4117

@fritzo fritzo closed this Dec 11, 2017
fritzo pushed a commit that referenced this pull request Jan 30, 2019
Summary:
Pull Request resolved: pytorch/FBGEMM#28

Pull Request resolved: pytorch#14516

This is the first diff in a series of diffs that will separate out avx2 specific code in separate files. The goal is to compile as little as possible code with avx2 and avx512 compiler flags.

Reviewed By: jianyuh

Differential Revision: D13248376

fbshipit-source-id: 401c2e9d3cd96c420fd08c3efa011febce96ffbb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants