A Julia package providing emission models for HiddenMarkovModels.jl. It supplies ready-to-use distributions that describe how observations are generated conditioned on the HMM's latent states.
using Pkg
Pkg.add("HiddenMarkovModels")
Pkg.add(url="https://github.com/rsenne/EmissionModels.jl")
using EmissionModels
using HiddenMarkovModels
# Create an emission model
dist = PoissonZeroInflated(5.0, 0.3)
# Sample, evaluate densities, or fit to data
x = rand(dist)
logp = logdensityof(dist, x)
fit!(dist, observations, weights)All types implement the HiddenMarkovModels emission interface (rand, logdensityof, fit!).
| Type | Description |
|---|---|
PoissonZeroInflated(λ, π) |
Zero-inflated Poisson for excess zeros in count data. |
| Type | Description |
|---|---|
MultivariateT(μ, Σ, ν) |
Full-covariance multivariate Student's t. |
MultivariateTDiag(μ, σ², ν) |
Diagonal-covariance multivariate Student's t. |
| Type | Description |
|---|---|
GaussianGLM(β, σ²) |
Linear regression with Gaussian noise. |
BernoulliGLM(β) |
Logistic regression for binary data. |
PoissonGLM(β) |
Log-linear regression for count data. |
GLM types support regularization via priors:
using EmissionModels: RidgePrior
β = zeros(3)
glm = GaussianGLM(β, 1.0, RidgePrior(0.5)) # L2 regularizationEach GLM is fit via fit!(glm, y, w; control_seq=X), where control_seq (design matrix X) maps latent states to the regression covariates.
HiddenMarkovModels.jl accepts any type that implements the following interface:
Random.rand(rng::AbstractRNG, dist::MyEmission)
DensityInterface.DensityKind(::MyEmission) # return HasDensity()
DensityInterface.logdensityof(dist::MyEmission, obs)
StatsAPI.fit!(dist::MyEmission, obs_seq, weight_seq)See the documentation for details.
EmissionModels.jl is not yet registered. Install from GitHub:
using Pkg
Pkg.add(url="https://github.com/rsenne/EmissionModels.jl")Contributions are welcome. Please follow the Julia Blue Style and add tests for new behavior. Pull requests and issues are appreciated.
EmissionModels.jl is licensed under the terms of the LICENSE file.