We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The current covariance (and correlation) methods overload Statistics.cov (Statistics.cor).
Statistics.cov
Statistics.cor
When using CovarianceEstimation.jl another cov method is exported that takes a CovarianceEstimator type.
cov
CovarianceEstimator
The issue is that as of 0.2.4, cov returns a Symmetric matrix which incorrectly wraps the NamedDimsArray if it gets given one.
Symmetric
NamedDimsArray
julia> using CovarianceEstimation, LinearAlgebra, NamedDims julia> x = NamedDimsArray{(:a, :b)}(rand(5, 5)); julia> estimator = LinearShrinkage(DiagonalCommonVariance(); corrected=true) julia> cov(estimator, x) 5×5 Symmetric{Float64,NamedDimsArray{(:b, :b),Float64,2,Array{Float64,2}}}: 0.0668947 -0.0 0.0 0.0 -0.0 -0.0 0.0668947 -0.0 0.0 0.0 0.0 -0.0 0.0668947 -0.0 0.0 0.0 0.0 -0.0 0.0668947 -0.0 -0.0 0.0 0.0 -0.0 0.0668947
We need to extend the function properly with:
function CovarianceEstimation.cov( estimator::LinearShrinkage, a::NamedDimsArray{L, T, 2}; dims=1, ) where {L, T} numerical_dims = dim(a, dims) data = cov(estimator, parent(a); dims=numerical_dims) names = symmetric_names(L, numerical_dims) return NamedDimsArray{names}(data) end
then we get
julia> cov(LinearShrinkage(DiagonalCommonVariance(); corrected=true), x) 5×5 NamedDimsArray{(:b, :b),Float64,2,Symmetric{Float64,Array{Float64,2}}}: 0.0668947 -0.0 0.0 0.0 -0.0 -0.0 0.0668947 -0.0 0.0 0.0 0.0 -0.0 0.0668947 -0.0 0.0 0.0 0.0 -0.0 0.0668947 -0.0 -0.0 0.0 0.0 -0.0 0.0668947
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
The current covariance (and correlation) methods overload
Statistics.cov
(Statistics.cor
).When using CovarianceEstimation.jl another
cov
method is exported that takes aCovarianceEstimator
type.The issue is that as of 0.2.4,
cov
returns aSymmetric
matrix which incorrectly wraps theNamedDimsArray
if it gets given one.We need to extend the function properly with:
then we get
The text was updated successfully, but these errors were encountered: