add ExponentialFamily and Dirichlet probability distribution#38445
add ExponentialFamily and Dirichlet probability distribution#38445iclementine merged 3 commits intoPaddlePaddle:developfrom
Conversation
|
Thanks for your contribution! |
ece7935 to
b9bdcfe
Compare
b9bdcfe to
2119cb1
Compare
2119cb1 to
fd01cc0
Compare
fd01cc0 to
343bfce
Compare
343bfce to
4e954e1
Compare
| """The KL-divergence between self distributions and other.""" | ||
| raise NotImplementedError | ||
|
|
||
| def prob(self, value): |
There was a problem hiding this comment.
what's the difference between 'def prob' and 'def probs', why do we need 'def prob' ?
There was a problem hiding this comment.
This has been discussed in design document. Currently, Paddle's pdf and log pdf method named probs and log_prob. It's not consistent, so we add prob method and probs will be deprecated in future.
There was a problem hiding this comment.
yes, will be deprecated in future.
| # inputs={"Alpha": concentration}, | ||
| # outputs={'Out': out}, | ||
| # attrs={}) | ||
| # return out |
There was a problem hiding this comment.
these annotations are expected?
There was a problem hiding this comment.
This pr need other pr dirichlet op #38244 to be merged, or not unittest will failed. _dirichlet function will be uncomment in next pr.
| """Returns event shape of distribution | ||
|
|
||
| Returns: | ||
| Tensor: event shape |
There was a problem hiding this comment.
I don't think the return type of the function is a Tensor.
There was a problem hiding this comment.
No, it's not a Tensor. It's doc mistake, and will be fixed.
| rtol=config.RTOL.get(config.DEFAULT_DTYPE), | ||
| atol=config.ATOL.get(config.DEFAULT_DTYPE)) | ||
|
|
||
| def test_entropy_expection(self): |
There was a problem hiding this comment.
will be fixed in next pr.
|
|
||
| natural_parameters = [] | ||
| for parameter in self._natural_parameters: | ||
| parameter = parameter.detach() |
There was a problem hiding this comment.
detach is not viable in static mode.
Why it is implemented like this?
There was a problem hiding this comment.
Now it's available in static mode.
| ('test-dirichlet-dist', | ||
| paddle.distribution.Dirichlet(paddle.to_tensor(config.xrand())))]) | ||
| class TestExponentialFamilyException(unittest.TestCase): | ||
| def test_entropy_expection(self): |
TCChenlong
left a comment
There was a problem hiding this comment.
LGTM
TODO:Fix API Docs
PR types
New features
PR changes
APIs
Describe
Examples