Skip to content

encapsulate logjac information in result #160

@tpapp

Description

@tpapp

The methods in this package keep track of absolute log Jacobian determinants by returning an extra value. This is somewhat brittle, I am proposing an alternative way of doing it.

Let

import Distributions: logpdf

struct LogJacVariate{T,S}
    x::T
    logjac::S
end

logpdf(d, v::LogJacVariate) = logpdf(d, v.x) + v.logjac

Then the API that replaces transform_and_logjac would just return a LogJacVariate.

Caveats: Distributions.jl is a heavy dependency. Factoring out the core, as proposed eg in JuliaStats/Distributions.jl#1139, would make this much easier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions