• Stars
    star
    286
  • Rank 143,876 (Top 3 %)
  • Language
    Jupyter Notebook
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tensorflow implementation of an HMM layer

Build Status

tensorflow_hmm

Tensorflow and numpy implementations of the HMM viterbi and forward/backward algorithms.

See Keras example for an example of how to use the Keras HMMLayer.

See test_hmm.py for usage examples. Here is an excerpt of the documentation from hmm.py for reference for now.

See also viterbi_wikipedia_example.py which replicates the viterbi example on wikipedia.

class HMM(object):
    """
    A class for Hidden Markov Models.

    The model attributes are:
    - K :: the number of states
    - P :: the K by K transition matrix (from state i to state j,
        (i, j) in [1..K])
    - p0 :: the initial distribution (defaults to starting in state 0)
    """

    def __init__(self, P, p0=None):

class HMMTensorflow(HMM):
      def forward_backward(self, y):
          """
          runs forward backward algorithm on state probabilities y
      
          Arguments
          ---------
          y : np.array : shape (T, K) where T is number of timesteps and
              K is the number of states
      
          Returns
          -------
          (posterior, forward, backward)
          posterior : list of length T of tensorflow graph nodes representing
              the posterior probability of each state at each time step
          forward : list of length T of tensorflow graph nodes representing
              the forward probability of each state at each time step
          backward : list of length T of tensorflow graph nodes representing
              the backward probability of each state at each time step
          """
      
      
      def viterbi_decode(self, y, nT):
          """
          Runs viterbi decode on state probabilies y.
      
          Arguments
          ---------
          y : np.array : shape (T, K) where T is number of timesteps and
              K is the number of states
          nT : int : number of timesteps in y
      
          Returns
          -------
          (s, pathScores)
          s : list of length T of tensorflow ints : represents the most likely
              state at each time step.
          pathScores : list of length T of tensorflow tensor of length K
              each value at (t, k) is the log likliehood score in state k at
              time t.  sum(pathScores[t, :]) will not necessary == 1
          """

More Repositories

1

talon_community

a single source of application-specific scripts
Python
121
star
2

gphoto2-timelapse

time lapse camera driver
Python
42
star
3

graphcore

Graphcore is a python library which allows you to query a computational graph structure backed by multiple databases, python functions and/or 3rd party services
Python
12
star
4

luamidi

LuaMIDI provides a simple interface for sending and receiving MIDI messages. The C++ library RtMidi is used at the core so cross-platform support is provided.
C++
11
star
5

functioncache

provides a decorator to use on your python functions which caches results to file - based off of filecache
Python
6
star
6

LunaticPython

Lunatic Python is a two-way bridge between Python and Lua, allowing these languages to intercommunicate. Being two-way means that it allows Lua inside Python, Python inside Lua, Lua inside Python inside Lua, Python inside Lua inside Python, and so on.
C
5
star
7

bowling-brackets

Simple Webapp which will generate brackets for a simple bowling tournament
Python
4
star
8

ssc_32u

Provides high level API to robot arm controlled by SSC-32U
Python
3
star
9

simplesparql

SimpleSPARQL allows queries to SPARQL endpoints in a very simple language similar to MQL
Python
3
star
10

heattransfer

Very simple heat transfer simulator
Python
3
star
11

voicecode_community_packages

This is a place where voicecode users can all contribute custom packages in a central location
CoffeeScript
3
star
12

torch_temporal_to_spatial

A torch implementation of nn.TemporalConvolution using nn.SpatialConvolution(MM), which is much faster in the GPU
Lua
3
star
13

picloud-shell

a super simple shell for accessing picloud
2
star
14

ose-cebpress-controller-board

Source files for the Open Source Ecology CEB Press Controller Board
Arduino
2
star
15

voicecode_help_voice

add commands to voicecode which support quickly searching voicecode commands
CoffeeScript
2
star
16

zipcode-to-state

Given a zipcode, returns the abbreviated state id
2
star
17

kumquat

A clean and simple cms designed to store basic structured data alongside a wiki, meant originally for the management of a student farm.
Python
2
star
18

voicecode_sound_device

voicecode command for changing the output device of your sound on a mac
CoffeeScript
1
star
19

swarm

opengl swarm engine
C++
1
star
20

axpress-nlp

A system for translating string queries using formal grammar
Java
1
star
21

deepfreq

my exploration of generating sound, music and beats with neural networks
Jupyter Notebook
1
star
22

scloudradio

SoundCloud Radio
JavaScript
1
star
23

python-ruby-tz

Maps Ruby's TimeZone names to UTC offsets in python.
Python
1
star
24

skype-toggle-mute

a simple script to toggle mute in skype on linux through dbus
Python
1
star
25

dotfiles

my dotfiles
Shell
1
star
26

bigbrother

Turn skype into big brother
1
star
27

quiqi

a grease monkey script which inserts an answer to your search query if there is one
JavaScript
1
star
28

single-instance-app

A python framework for a single instance application. First call to the script spawns a process, subsequent calls are passed to the first
Python
1
star