Open Vilin97 opened 8 months ago
We should probably do something like:
struct LogDensityFunction{F}
f::F
dim::Int
end
LogDensityProblems.logdensity(ldf::LogDensityFunction, x) = ldf.f(x)
LogDensityProblems.dimension(ldf::LogDensityFunction) = ldf.dim
LogDensityProblems.capabilities(::Type{<:LogDensityFunction}) = LogDensityProblems.LogDensityOrder{0}()
which is going to be type-stable.
But IMO this is not something we should put in AdvancedHMC.jl :confused: Probably would be better suited to go in LogDensityProblems.jl itself or maaaybe AbstractMCMC.jl or something like this. @devmotion thoughts?
It would be great if there was an easy interface to define a model without having to create a custom
struct
and wrap it inLogDensityModel
. Its signature would beLogDensityModel(logpdf, D)
and it would be something likeWith such interface the lengthy example from the README would become