You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use Distributions.loglikelihood instead of Distributions.logpdf (#153)
This PR replaces some occurrences of `logpdf` with `loglikelihood` since the former is intended to be used for a single sample only but we are interested in the log probability of individual and multiple samples.
JuliaStats/Distributions.jl#1144 allows us to use `loglikelihood` even for individual samples and arrays of samples (everything that can be sampled by `rand` should support the computation of `loglikelihood`). Currently, `logpdf` is misused (also in DistributionsAD) to compute arrays of log densities for multiple samples which are summed afterwards. Usually, this intermittent step can be avoided by summing the log densities directly (which is the default implementation in Distributions).
Similar issues and possible optimizations exist for `Bijectors.logpdf_with_trans` (see TuringLang/Bijectors.jl#120).
Co-authored-by: Hong Ge <[email protected]>
0 commit comments