KeyedDistributions
KeyedDistributions.KeyedDistribution
KeyedDistributions.KeyedDistribution
KeyedDistributions.KeyedDistribution
KeyedDistributions.KeyedSampleable
KeyedDistributions.KeyedSampleable
AxisKeys.axiskeys
KeyedDistributions.distribution
KeyedDistributions.KeyedDistribution
— TypeKeyedDistribution(d<:Distributions.Distribution, keys::Tuple{Vararg{AbstractVector}})
KeyedDistribution(d<:Distributions.Distribution; named_keys...)
Stores the keys
(and dimnames if using named_keys
kwargs) for each variate alongside the Distributions.Distribution
d
, supporting all of the common functions of a Distributions.Distribution
and KeyedArray
.
Common functions that return an AbstractArray
, such as rand
, will return a KeyedArray
with keys and dimnames derived from the Distributions.Distribution
.
The type of keys
is restricted to be consistent with AxisKeys.jl. The length of the keys
tuple or number of named_keys
must equal the number of dimensions, which is 1 for univariate and multivariate distributions, and 2 for matrix-variate distributions. The length of each key vector in must match the length along each dimension.
For distributions that can be marginalised exactly, the KeyedDistribution can be marginalised via the indexing or lookup syntax just like KeyedArray
s. i.e. One can use square or round brackets to retain certain indices or keys and marginalise out the others. For example for D::KeyedMvNormal
over :a, :b, :c
:
D(:a)
or D[1] will marginalise out:b, :c
and return aKeyedNormal
over:a
.D([:a])
or D[[1]] will marginalise out:b, :c
and return aKeyedMvNormal
over:a
.D([:a, :b])
orD[[1, 2]]
will marginalise out:c
and return aKeyedMvNormal
over:a, :b
.
KeyedDistributions.KeyedDistribution
— MethodKeyedDistribution(d::Distribution)
Constructs a KeyedDistribution
using the keys and dimnames of the parameter that matches size(d)
. If the parameter has no keys, uses 1:n
for the length n
of each dimension.
KeyedDistributions.KeyedDistribution
— MethodKeyedDistribution(d<:Distributions.Distribution, keys::AbstractVector)
Constructor for KeyedDistribution
with one dimension of variates. The elements of keys
correspond to the variates of the distribution.
KeyedDistributions.KeyedSampleable
— TypeKeyedSampleable(d<:Distributions.Sampleable, keys::Tuple{Vararg{AbstractVector}})
KeyedSampleable(d<:Distributions.Sampleable; named_keys...)
Stores the keys
(and dimnames if using named_keys
kwargs) for each variate alongside the Distributions.Sampleable
d
, supporting all of the common functions of a Distributions.Sampleable
and KeyedArray
.
Common functions that return an AbstractArray
, such as rand
, will return a KeyedArray
with keys and dimnames derived from the Distributions.Sampleable
.
The type of keys
is restricted to be consistent with AxisKeys.jl. The length of the keys
tuple or number of named_keys
must equal the number of dimensions, which is 1 for univariate and multivariate distributions, and 2 for matrix-variate distributions. The length of each key vector in must match the length along each dimension.
For distributions that can be marginalised exactly, the KeyedSampleable can be marginalised via the indexing or lookup syntax just like KeyedArray
s. i.e. One can use square or round brackets to retain certain indices or keys and marginalise out the others. For example for D::KeyedMvNormal
over :a, :b, :c
:
D(:a)
or D[1] will marginalise out:b, :c
and return aKeyedNormal
over:a
.D([:a])
or D[[1]] will marginalise out:b, :c
and return aKeyedMvNormal
over:a
.D([:a, :b])
orD[[1, 2]]
will marginalise out:c
and return aKeyedMvNormal
over:a, :b
.
KeyedDistributions.KeyedSampleable
— MethodKeyedSampleable(d<:Distributions.Sampleable, keys::AbstractVector)
Constructor for KeyedSampleable
with one dimension of variates. The elements of keys
correspond to the variates of the distribution.
AxisKeys.axiskeys
— Methodaxiskeys(d::Union{KeyedDistribution, KeyedSampleable})
Return the keys for the variates of the KeyedDistribution
or KeyedSampleable
.
KeyedDistributions.distribution
— Methoddistribution(::KeyedDistribution) -> Distribution
distribution(::KeyedSampleable{F, S, D}) -> D
Return the wrapped distribution.