Problem with installing installing HiddenMarkovModels.jl

I was trying to install the HiddenMarkovModels.jl package, by copy pasting the command

julia> Pkg.add("HiddenMarkovModels")

But it throws the error

ERROR: The following package names could not be resolved:
 * HiddenMarkovModels (not found in project, manifest or registry)

Stacktrace:
 [1] pkgerror(::String) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:52
 [2] ensure_resolved(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; registry::Bool) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:837
 [3] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:177
 [4] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:139
 [5] #add#21 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:67 [inlined]
 [6] add at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:67 [inlined]
 [7] #add#20 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:66 [inlined]
 [8] add at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:66 [inlined]
 [9] add(::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:65
 [10] add(::String) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:65
 [11] top-level scope at REPL[3]:1

I wonder if I am missing something obvious ? Any help would be much appreciated. Thank you.

The last commit on this package was 5 years ago, so pre 1.0.

Unfortunately this package is also too outdated to install on post 1.0 julia versions.

1 Like

I see. Thanks,
Do you know of any other Julia package for hidden Markov models, by any chance ?

No idea. Hopefully someone can chime in.

Hmmm. thanks anyways

HMMBase is nice :

1 Like

HHMBase may have some problems with its documentation. I was just trying it out, and the key commands mentioned in the documentation, such as

    fit_mle(hmm, y, display = :iter)

and

z, y = rand(hmm, 500, seq = true)

generate errors.

For example

julia> z, y = rand(hmm, 500, seq = true);
ERROR: MethodError: no method matching rand(::HMM{Multivariate,Float64}, ::Int64; seq=true)
Closest candidates are:
  rand(::AbstractHMM, ::Int64; initial_state) at C:\Users\iamsu\.julia\packages\HMMBase\Sv6Fz\src\hmm.jl:95 got unsupported keyword argument "seq"
  rand(::Any, ::Integer, ::Integer...) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Random\src\Random.jl:283 got unsupported keyword argument "seq"
  rand(::Hypergeometric, ::Int64) at C:\Users\iamsu\.julia\packages\Distributions\dTXqn\src\common.jl:145 got unsupported keyword argument "seq"

and

julia> hmm = fit_mle(hmm, y, display = :iter)
ERROR: MethodError: no method matching fit_mle(::HMM{Multivariate,Float64}, ::Array{Float64,2}; display=:iter)
Closest candidates are:
  fit_mle(::Type{DiscreteUniform}, ::AbstractArray{T,N} where N) where T<:Real at C:\Users\iamsu\.julia\packages\Distributions\dTXqn\src\univariate\discrete\discreteuniform.jl:102 got unsupported keyword argument "display"
  fit_mle(::Type{MvNormal{Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Array{Float64,1}}}, ::AbstractArray{Float64,2}) at C:\Users\iamsu\.julia\packages\Distributions\dTXqn\src\multivariate\mvnormal.jl:437 got unsupported keyword argument "display"
  fit_mle(::Type{MvNormal{Float64,PDMats.PDiagMat{Float64,Array{Float64,1}},Array{Float64,1}}}, ::AbstractArray{Float64,2}, ::AbstractArray{T,1} where T) at C:\Users\iamsu\.julia\packages\Distributions\dTXqn\src\multivariate\mvnormal.jl:452 got unsupported keyword argument "display"
  ...
Stacktrace:
 [1] top-level scope at REPL[22]:1

It works for me, fwiw, what version are you using?

My Julia version is 1.5.3

[quote="[ANN] HMMBase.jl - A lightweight and efficient Hidden Markov Model abstraction, post:1, topic:21604"]
HMMBase.jl
[/quote]

And you are sure the following fails?

julia> using HMMBase, Distributions

julia> begin
       a = [0.6, 0.4]
       A = [0.9 0.1; 0.1 0.9]
       B = [MvNormal([0.0, 5.0], ones(2) * 1), MvNormal([0.0, 5.0], ones(2) * 3)]
       hmm = HMM(a, A, B)
       size(hmm) # (number of states, observations dimension)
       z, y = rand(hmm, 500, seq = true)
       end
([1, 1, 2, 2, 2, 2, 2, 2, 2, 2  …  1, 1, 1, 1, 1, 1, 1, 1, 2, 2], [-0.006069869072965825 4.38240408044243; 1.7874955653995437 2.8185030200194836; … ; 0.2190119557894221 7.671357820101437; -4.331434453733355 5.4811290326667645])

Unfortunately, yes

julia> using HMMBase, Distributions

julia> begin
              a = [0.6, 0.4]
                     A = [0.9 0.1; 0.1 0.9]
              B = [MvNormal([0.0, 5.0], ones(2) * 1), MvNormal([0.0, 5.0], ones(2) * 3)]
              hmm = HMM(a, A, B)
              size(hmm) # (number of states, observations dimension)
              z, y = rand(hmm, 500, seq = true)
              end
ERROR: MethodError: no method matching rand(::HMM{Multivariate,Float64}, ::Int64; seq=true)
Closest candidates are:
  rand(::AbstractHMM, ::Int64; initial_state) at C:\Users\iamsu\.julia\packages\HMMBase\Sv6Fz\src\hmm.jl:95 got unsupported keyword argument "seq"
  rand(::Any, ::Integer, ::Integer...) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Random\src\Random.jl:283 got unsupported keyword argument "seq"
  rand(::Hypergeometric, ::Int64) at C:\Users\iamsu\.julia\packages\Distributions\dTXqn\src\common.jl:145 got unsupported keyword argument "seq"
  ...
Stacktrace:
 [1] kwerr(::NamedTuple{(:seq,),Tuple{Bool}}, ::Function, ::HMM{Multivariate,Float64}, ::Int64) at .\error.jl:157
 [2] top-level scope at REPL[2]:7

julia>        

It works for me, maybe you have an old version of HMMBase ?

Mine : HMMBase v1.0.6, Distributions v0.23.12 (do ]st to see it)

1 Like

There’s also HMMGradients in case you want to train HMMs using gradient based techniques.

Btw, it’s really a shame these packages are not updated.
Ben Connault had really amazing packages for estimating discrete choice models.
Economists have nothing like this in any other language!
(Only other thing is PyBLP.py)

Sometimes really good ppl leave academia for industry…