Skip to content

Add iszero(x) branches to xlogy and xlog1py#54

Closed
simsurace wants to merge 3 commits intoJuliaStats:masterfrom
simsurace:xlogy_etc
Closed

Add iszero(x) branches to xlogy and xlog1py#54
simsurace wants to merge 3 commits intoJuliaStats:masterfrom
simsurace:xlogy_etc

Conversation

@simsurace
Copy link
Contributor

Some of the tests don't pass yet. Maybe a finite differencing setup issue, I don't know. I'll take another look tomorrow or next week.

Comment on lines +28 to +30
∂y = iszero(y) ? oftype(w, NaN) : w
end
∂x = iszero(y) ? oftype(logy, NaN) : logy
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if these should be added, even if it makes the rule match finite differencing. NaN is usually not very useful as it infects everything. So eg the forward rule will always yield NaN for any of these conditions. See eg https://juliadiff.org/ChainRulesCore.jl/stable/maths/nondiff_points.html.

Copy link
Contributor Author

@simsurace simsurace Jul 8, 2022

Choose a reason for hiding this comment

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

This is a bit mysterious to me. On the (seemingly equivalent) branches in the rrule for logpdf of NegativeBinomial we wanted NaN. Was this something specific to Distributions.jl?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy to change this but I'm unsure about the discrepancy to Distributions.jl

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