improbable-research / keanu

A probabilistic approach from an Improbabilistic company
MIT License
150 stars 33 forks source link

Adding vertex for transition matrices #210

Open johannespetrat opened 6 years ago

johannespetrat commented 6 years ago

For models with a time-step (such as Hidden Markov Models) it is often necessary to implement a transition matrix. If we had three states A, B and C and pAB is the probability of transitioning from A to B then we can describe our transition matrix as <a href="https://www.codecogs.com/eqnedit.php?latex=\Bigl(\begin{matrix}&space;p{AA}&space;&&space;p{AB}&p{AC}&space;\&space;p{BA}&space;&&space;p{BB}&p{BC}&space;\&space;p{CA}&space;&&space;p{CB}&p{CC}&space;\end{matrix}\Bigr)&space;\&space;\&space;\text{where&space;}&space;p{AA}&space;+&space;p{AB}&space;+&space;p_{AC}&space;=&space;1" target="blank"><img src="https://latex.codecogs.com/gif.latex?\Bigl(\begin{matrix}&space;p{AA}&space;&&space;p{AB}&p{AC}&space;\&space;p{BA}&space;&&space;p{BB}&p{BC}&space;\&space;p{CA}&space;&&space;p{CB}&p{CC}&space;\end{matrix}\Bigr)&space;\&space;\&space;\text{where&space;}&space;p{AA}&space;+&space;p{AB}&space;+&space;p{AC}&space;=&space;1" title="\Bigl(\begin{matrix} p{AA} & p{AB}&p{AC} \ p{BA} & p{BB}&p{BC} \ p{CA} & p{CB}&p{CC} \end{matrix}\Bigr) \ \ \text{where } p{AA} + p{AB} + p_{AC} = 1" />

This would be really similar to the current implementation of the DirichletVertex. In the DirichletVertex all probabilities sum to 1, but for a transition matrix we only want the rows to sum to 1.

springcoil commented 6 years ago

Plus one on this :)

sshcherbakov commented 4 years ago

Just a quick question. Am I understanding correctly, that state now (Sept. 2020), the Keanu library doesn't support or provide all needed primitives to model Markov chains and process and also cannot be used (alone) to model HMM (Hidden Markov Model)?