-
Notifications
You must be signed in to change notification settings - Fork 432
Add ChainRules definitions for pdf of PoissonBinomial
#1390
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
Codecov Report
@@ Coverage Diff @@
## master #1390 +/- ##
==========================================
+ Coverage 82.44% 82.54% +0.09%
==========================================
Files 116 116
Lines 6911 6950 +39
==========================================
+ Hits 5698 5737 +39
Misses 1213 1213
Continue to review full report at Codecov.
|
|
Looks good, I had tried to start something in https://github.com/matbesancon/DistributionsDiff.jl/ but never got around sitting to continue this |
|
do you want to implement frule in this PR or a following one? |
|
I'll add the |
|
I added them 👍 |
|
Great! Is this is the first AD in |
|
AFAIK yes. |
Yes; but only because AD generally works off the shelf without having to implement anything extra. |
|
Awesome! |
I am in the process of updating DistributionsAD to ChainRules 1. I thought it would be a good opportunity to reduce the amount of type piracy and move rules for functions in Distributions here. Currently, there's only one such rule in DistributionsAD. It defines the pullback for the pdf of the
PoissonBinomialdistribution, so the PR adds and tests only this rule.ChainRulesCore 1 is a very lightweight package (see @oxinabox's comment for more details) and Distributions already depends on ChainRulesCore indirectly via SpecialFunctions and StatsFuns (support for ChainRules was added in version 0.9.10 which was released today). DistributionsAD does not support ChainRulesCore 1 yet, so the definitions in Distributions won't lead to any conflicts with DistributionsAD if we remove the
rrules in DistributionsAD before we tag a CR1-compatible release.The implementation is based on the same dynamic programming "trick" as the implementation of
poissonbinomial_pdf. I didn't find any reference for it, I only derived it a while ago and added it to DistributionsAD. However, I am pretty confident that the ChainRules tests utilities would have revealed any errors./ cc: @bdeonovic who added the primal definition in #1198