-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
why do cov and invcov call full? #572
Comments
I wasnøt aware of that. Returning a |
Is that the only place we'd return a |
The only surprise here might be that Why |
@jmxpearson Good point. I wasn't aware of that. I think we should try to change that and only return |
The original problem where this came up is currently implemented as """
Given covariance matrix Σ, shrinks the eigenvalues to their mean by a
factor `shrink` (the transformation is not volume-preserving), the
scake covariance matrix is scaled by
`Σ_scale * 2.4^2/d`
where `Σ_scale=1` yields the value recommended for random-walk
Metropolis.
"""
function scale_Σ(Σ, shrink=0.2, Σ_scale=1.0)
@assert 0 ≤ shrink ≤ 1
fact = eigfact(Symmetric(Σ))
λs = sqrt.(fact[:values])
λ0 = mean(λs)
fact[:values] .= λs .* (1-shrink) + λ0*shrink
d = size(chain)[2]
PDMat(Symmetric(full(fact) .* (Σ_scale*2.4^2/d)))
end with the idea that I can do |
I agree that there should be a function that directly returns the internal representation, i.e. What about something like |
Or |
If |
This was resolved in PDMats.jl by JuliaStats/PDMats.jl#105, included in the package as of version 0.10, which is already the lower bound in Distributions.jl. I can prepare a PR that fixes this. |
Internally many multivariate distributions represent the scale as a subtype of
PDMats.AbstractPDMat
, yetcov
andinvcov
callfull
before returning it. This seems premature, eg suppose the user wants to do an eigendecomposition before some transformation, then it has to be converted back, or reconstructed from the parameters.The text was updated successfully, but these errors were encountered: