JuliaMath / JuliaMath/DensityInterface.jl

Future option: Express mass/normalization of densities

Open
#8 65 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Julia
Stars
12
Forks
2
PR merge metrics
No merged PRs in 30d

Description

I've been previously thinking about whether and how a density interface should include the possibility to require or check for normalization, so I'm just posing this for discussion here.

Options that come to my mind:

```julia
# extra argument and dispatch
logdensityof(d, x; normalized=Val{false}())
```

Or maybe include a whole machinery for dealing with normalization constants?

```julia
# like eltype/length traits
hasnormalizingconstant(d) = false
normalizingconstant(d::SomeDensity) = ...
isnormalized(d) = normalizingconstant(d) == 1

# probably should be its own struct
normalize(d) = let logZ = log(normalizingconstant(d))
logfuncdensity(x -> logdensityof(d, x) - logZ)
end
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.