Skip to content

Commit

Permalink
Third pass for ARHMM
Browse files Browse the repository at this point in the history
  • Loading branch information
fausto-mpj committed Dec 9, 2024
1 parent b6eb4cc commit cf3c5f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/inference/viterbi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function initialize_viterbi(
control_seq::AbstractVector;
seq_ends::AbstractVectorOrNTuple{Int},
)
N, T, K = size(hmm, control_seq[1]), length(obs_seq), length(seq_ends)
N, T, K = length(hmm), length(obs_seq), length(seq_ends)
R = eltype(hmm, obs_seq[1], control_seq[1])
q = Vector{Int}(undef, T)
logL = Vector{R}(undef, K)
Expand Down
9 changes: 3 additions & 6 deletions src/types/abstract_hmm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Return the number of states of `hmm`.
"""
Base.length(hmm::AbstractHMM) = length(initialization(hmm))


"""
eltype(hmm, obs, control)
Expand All @@ -54,21 +53,19 @@ end

"""
initialization(hmm)
initialization(hmm, control)
Return the vector of initial state probabilities for `hmm` (possibly when `control` is applied).
Return the vector of initial state probabilities for `hmm`.
"""
function initialization end

"""
log_initialization(hmm)
Return the vector of initial state log-probabilities for `hmm` (possibly when `control` is applied).
Return the vector of initial state log-probabilities for `hmm`.
Falls back on `initialization`.
"""
log_initialization(hmm::AbstractHMM) =
elementwise_log(initialization(hmm))
log_initialization(hmm::AbstractHMM) = elementwise_log(initialization(hmm))

"""
transition_matrix(hmm)
Expand Down

0 comments on commit cf3c5f7

Please sign in to comment.