Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

AbstractHMM subtyping #5

Open
nantonel opened this issue May 29, 2019 · 1 comment
Open

AbstractHMM subtyping #5

nantonel opened this issue May 29, 2019 · 1 comment

Comments

@nantonel
Copy link
Contributor

Hi,

thanks for this nice package!

I was wandering what is the advantage of having the subtype VariateForm AbstractHMM{F<:VariateForm}?

I feel there is no real necessity of having this since you can get it from the vector of distribution.

@nantonel
Copy link
Contributor Author

nantonel commented May 29, 2019

I see this is used here for example:

function likelihoods(hmm::AbstractHMM{Univariate}, observations)
    hcat(map(d -> pdf.(d, observations), hmm.D)...)
end

function likelihoods(hmm::AbstractHMM{Multivariate}, observations)
    # OPTIMIZE ?
    ls = zeros(size(observations)[1], size(hmm)[1])
    @inbounds for i = 1:size(hmm)[1], t = 1:size(observations)[1]
        ls[t,i] = pdf(hmm.D[i], view(observations,t,:))
    end
    ls
end

but this different implementation would not be necessary if observations coming from multivariate distributions were Arrays of Arrays.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant