HiddenMarkovModelReaders.jl

Hidden Markov model and unsupervised hypothesis generator for signal processing and anomaly detection.
Author DanielRivasMD
Popularity
3 Stars
Updated Last
1 Year Ago
Started In
May 2021

HiddenMarkovModelReaders

Hidden Markov model and unsupervised hypothesis generator for signal processing and anomaly detection

Repo status MIT license Stable Dev

Ask us anything ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

GitHub tag (latest SemVer pre-release)

HiddenMarkovModelReaders

Description

HiddenMarkovModelReaders is a package for creating Hidden Markov models and unsupervised hypothesis generation for signal processing and anomaly detection.

Installation

julia>]
pkg> add HiddenMarkovModelReaders

To exit Pkg mode, just backspace. Once the package is installed it can be imported with:

julia> using HiddenMarkovModelReaders

For more information, see the Pkg documentation.

Usage

Using Parameters.jl and HMMParams struct the user can control all of the parameters of the model in a user friendly way.

The distance function passed to HMMParams struct could either be a function:

  • Contained in HiddenMarkovModelReaders package, i.e., euclideanDistance or bhattacharyyaDistance, for Euclidean or Bhattacharyya distances, respectively.
  • A user predefined function whose declaration precceds the HMMParams strcutor.
  • A lambda or anonymous function defined within the struct declaration.

The function must be of the form function distance(arr::Array{T, 1}, h::Array{T, 1}) where T <: Number.

# Hidden Markov model parameters

# Declare all values explicitly
explicitParams = HMMParams(
  penalty                    = 200,
  distance                   = bhattacharyyaDistance,      # package-defined distance function
  minimumFrequency           = 20,
  verbosity                  = false,
)

# Use default values and use package-defined distance function
defaultParams = HMMParams(
  distance                   = euclideanDistance,          # package-defined distance function
)

# User-defined distance function
function myDistance(arr, h)
  return (arr .- h) .^ 2
end

# Use prefined distance function
myfunctionParams = HMMParams(
  distance                   = myDistance,                 # user-predefined distance function
)

# Use lambda distance function within struct declaration
lambdaFunctionParams = HMMParams(
  distance                   = x, y -> (x .- y) .^ 2       # lambda or anonymous distance function
)

Initialize a Hidden Markov model object with setup function.

# declare random two-dimensional array
x = rand(10, 5)

# setup Hidden Markov model object
hmm = setup(x)

Control the training using process! function.

# create a dictionary to hold results
resultsDc = Dict()

# procces Hidden Markov model with state splitting option
resultsDc[1] = process!(hmm, x, true, params = hmmParams)

# procces Hidden Markov model without state splitting option
resultsDc[2] = process!(hmm, x, false, params = hmmParams)

Citations

If you use HiddenMarkovModelReaders or derivates in your work, please consider citing the code record.

Contributing and Support

ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

In general contributions should follow ColPrac. If you are interested in extending/improving HiddenMarkovModelReaders, head to the discussions to reach out. For support with using HiddenMarkovModelReaders, please open an issue describing the problem and steps to reproduce it.

License

This package is licensed under the MIT Expat license. See LICENSE for more informaiton.


Author's Note: This package is still under active development and is subject to change.

Used By Packages

No packages found.