Grouped transition matrices
GroupedTransitions stores transition probabilities for models whose states can be partitioned into equally sized groups. Entries on the diagonal blocks stay fully parameterised while every off-diagonal block shares a single probability per pair of groups. This reduces the number of learnable parameters and keeps the transition matrix stochastic after each Baum–Welch update.
julia> trans = HMMRBM.GroupedTransitions(3, 2); # 3 groups, 2 states each
julia> size(trans)
(6, 6)
julia> trans[1, 4]
0.16666666666666666Grouped transitions can be passed directly to the transitions field of MultiSeqHMM and will be kept consistent during the EM loop via HMMRBM.baum_welch_transition_update!.
Constructors
HMMRBM.GroupedTransitions — Type
struct GroupedTransitions{T, W<:AbstractArray{T,3}, B<:AbstractMatrix{T}} <: AbstractMatrix{T}
GroupedTransitions(within, between)
GroupedTransitions(::Type{<:AbstractArray}, ::Type{<:AbstractMatrix}, group_count, states_per_group)
GroupedTransitions(::Type{<:Real}, group_count, states_per_group)
GroupedTransitions(group_count, states_per_group)A transition matrix with grouped structure. The states are divided into group_count groups, each containing states_per_group states. Transitions within the same group are free, while transitions between different groups share the same probability.
Accessors
HMMRBM.group_count — Function
group_count(A::GroupedTransitions)Get the number of groups represented by the grouped transition matrix.
HMMRBM.states_per_group — Function
states_per_group(A::GroupedTransitions)Get the number of states per group represented by the grouped transition matrix.
HMMRBM.state_count — Method
state_count(A::GroupedTransitions)Get the total number of states represented by the grouped transition matrix.
Training support
HMMRBM.baum_welch_transition_update! — Method
baum_welch_transition_update!(trans, logtrans, expected)Update the transition matrix trans and logtrans in place using the expected transition counts expected.