I noticed this syntax in the DynamicHMCExamples package.
@unpack y, X, σ = problem
@unpack β = θ
loglik = sum(logpdf.(Bernoulli.(logistic.(X*β)), y))
logpri = sum(logpdf.(Ref(Normal(0, σ)), β))
loglik + logpri
Please can someone explain what this does - I haven’t found any instances of this form of declaration elsewhere.
It is this: https://docs.julialang.org/en/v1/manual/methods/index.html#Function-like-objects-1
Methods are associated with types, so it is possible to make any arbitrary Julia object “callable” by adding methods to its type. (Such “callable” objects are sometimes called “functors.”)
I should probably explain things like this in the package docs, which will eventually evolve into an introduction for programming, debugging, and optimizing your own log posteriors in Julia.