invenia / invenia/KeyedDistributions.jl
`KeyedDistribution` allows mismatch between the keys and the underlying distribution keys
- Dominant language
- Julia
- Stars
- 4
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
```julia
julia> ka = KeyedArray(rand(3), down=["a", "b", "c"]);
julia> mvn = MvNormal(ka, [1, 1, 1]);
julia> mean(mvn)
1-dimensional KeyedArray(NamedDimsArray(...)) with keys:
↓ down ∈ 3-element Vector{String}
And data, 3-element Vector{Float64}:
("a") 0.8185032515167808
("b") 0.2940895403871865
("c") 0.7714754947104043
julia> kd = KeyedDistribution(mvn, [1, 2, 3]);
julia> mean(kd)
1-dimensional KeyedArray(NamedDimsArray(...)) with keys:
↓ _ ∈ 3-element Vector{Int64}
And data, 3-element Vector{Float64}:
(1) 0.8185032515167808
(2) 0.2940895403871865
(3) 0.7714754947104043
```
Should this be allowed? It bit me recently where I've accidentally constructed the KeyedDistribution without naming the dimension. Maybe we want to check this when constructing the KeyedDistribution?
(Similar thing for `var`)
Similar to https://github.com/invenia/KeyedDistributions.jl/issues/17
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.