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
mean
I think the error in the following case is the right thing to do.
I wonder whether we should error earlier, when constructing the KeyedDistribution, and never end up with this situation in the first place?
KeyedDistribution
julia> ka = KeyedArray(rand(3), down=["a", "b", "c"]) 1-dimensional KeyedArray(NamedDimsArray(...)) with keys: ↓ down ∈ 3-element Vector{String} And data, 3-element Vector{Float64}: ("a") 0.96797267150684 ("b") 0.812350723246477 ("c") 0.3433194732682169 julia> kd = KeyedDistribution(MvNormal(ka, [1, 1, 1]), [1, 2, 3]) KeyedMvNormal{MvNormal{Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, KeyedArray{Float64, 1, NamedDimsArray{(:down,), Float64, 1, Vector{Float64}}, Base.RefValue{Vector{String}}}}}( d: MvNormal{Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, KeyedArray{Float64, 1, NamedDimsArray{(:down,), Float64, 1, Vector{Float64}}, Base.RefValue{Vector{String}}}}( dim: 3 μ: [0.96797267150684, 0.812350723246477, 0.3433194732682169] Σ: [1.0 0.0 0.0; 0.0 1.0 0.0; 0.0 0.0 1.0] ) keys: ([1, 2, 3],) ) julia> mean(kd) ERROR: ArgumentError: key vectors must agree; got ["a", "b", "c"] != [1, 2, 3] Stacktrace: [1] unify_one @ ~/.julia/packages/AxisKeys/rTIBR/src/broadcast.jl:81 [inlined] [2] map @ ./tuple.jl:246 [inlined] [3] unify_keys @ ~/.julia/packages/AxisKeys/rTIBR/src/broadcast.jl:73 [inlined] [4] KeyedArray(A::KeyedArray{Float64, 1, NamedDimsArray{(:down,), Float64, 1, Vector{Float64}}, Base.RefValue{Vector{String}}}, k2::Tuple{Vector{Int64}}) @ AxisKeys ~/.julia/packages/AxisKeys/rTIBR/src/struct.jl:36 [5] mean(d::KeyedMvNormal{MvNormal{Float64, PDMats.PDiagMat{Float64, Vector{Float64}}, KeyedArray{Float64, 1, NamedDimsArray{(:down,), Float64, 1, Vector{Float64}}, Base.RefValue{Vector{String}}}}}) @ KeyedDistributions ~/JuliaEnvs/RiskModels/dev/KeyedDistributions/src/KeyedDistributions.jl:184 [6] top-level scope @ REPL[92]:1
The text was updated successfully, but these errors were encountered:
related to #17
Sorry, something went wrong.
This no longer breaks, it uses the keys from the KeyedDistribution.
No branches or pull requests
I think the error in the following case is the right thing to do.
I wonder whether we should error earlier, when constructing the
KeyedDistribution
, and never end up with this situation in the first place?The text was updated successfully, but these errors were encountered: