Giter Site home page Giter Site logo

factorial_hmm's People

Contributors

regevs avatar scarmi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

factorial_hmm's Issues

EM on multiple sequences of observed states

I would be nice to have the EM method of FullDiscreteFactorialHMM also support multiple sequences of observed states.
For instance, the fit method of hmmlearn allows parameters estimation from multiple sequences for basic (i.e., non-factorial) HMMs (see https://github.com/hmmlearn/hmmlearn/blob/master/lib/hmmlearn/base.py#L440-L488).

This probably requires to split MStep in two parts: the former (equivalent of hmmlearn's _accumulate_sufficient_statistics) will collect statistics about the parameters and will need to be called on every sequence of observed states; the latter (equivalent of hmmlearn's _do_mstep) will be required to normalize the parameters and will need to be called only once per iteration.

MultiplyTransitionMatrixVector doesn't work for me

I'm having trouble following the logic of the MultiplyTransitionMatrixVector function and I have thusfar been unable to get this function to work as demonstrated by the simple example below... Any guidance would be greatly appreciated -- thanks!

Python 3.7.1 (default, Dec 14 2018, 13:28:58) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from factorial_hmm_test import *                                                                                        

In [2]: from factorial_hmm import *                                                                                             

In [3]: model = ExampleFullDiscreteFactorialHMM(11)                                                                             

In [4]: model.GetTransitionMatrix(0) @ np.random.randn(16)                                                                      
Out[4]: 
array([-0.0381503 ,  0.08041185, -0.07615602,  0.4513467 , -0.06822525,
        0.02532833, -0.37132319,  0.41988943, -0.06897605, -0.00527082,
       -0.16544137,  0.1655481 , -0.0785179 , -0.04276934, -0.54833598,
        0.15224777])

In [5]: model.MultiplyTransitionMatrixVector(0, np.random.randn(16))                                                            
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-1777e0d59086> in <module>
----> 1 model.MultiplyTransitionMatrixVector(0, np.random.randn(16))

~/code/factorial_hmm/factorial_hmm.py in MultiplyTransitionMatrixVector(self, n_step, vector, transpose)
     74                 vector,
     75                 self.idx_in,
---> 76                 self.idx_out[i],
     77                 )
     78 

<__array_function__ internals> in einsum(*args, **kwargs)

~/anaconda3/lib/python3.7/site-packages/numpy/core/einsumfunc.py in einsum(*operands, **kwargs)
   1354     # If no optimization, run pure einsum
   1355     if optimize_arg is False:
-> 1356         return c_einsum(*operands, **kwargs)
   1357 
   1358     valid_einsum_kwargs = ['out', 'dtype', 'order', 'casting']

ValueError: einstein sum subscripts string contains too many subscripts for operand 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.