Closed sandaur closed 6 years ago
Try MultivariateGaussianDistribution instead of NormalDistribution. I'm currently working on a patch that will make it so that if you specify NormalDistribution on multivariate data it will model each feature using a normal distribution, but right now it just does something wrong.
Thanks for answer.
What i did was change all the constructions of my states for this
State(MultivariateGaussianDistribution([0,0], np.eye(2)))
But got the same result. I have to change something else?
Your data is 10 dimensional, right? Why are you modeling it with a two dimensional Gaussian?
On Wed, May 30, 2018 at 10:31 AM sandaur notifications@github.com wrote:
Thanks for answer.
What i did was change all the constructions of my states for this
State(MultivariateGaussianDistribution([0,0], np.eye(2)))
But got the same result. I have to change something else?
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/jmschrei/pomegranate/issues/448#issuecomment-393250315, or mute the thread https://github.com/notifications/unsubscribe-auth/ADvEECkgaVbulWG-Excvb58Fbfuk-6FSks5t3teJgaJpZM4USOUl .
I'm sorry, i haven't used this distribution before, copy paste the first example i had found.
Now i used this, 10 dimensional mean vector and 10x10 dimensional covariance matrix.
State(MultivariateGaussianDistribution(np.zeros([10]), np.eye(10)))
Still nothing, got the same unaltered transition matrix.
The reason is because the model wasn't training. If you passed in verbose=True
you would see the following:
[1] Improvement: nan Time (s): 4.697e-05
Total Training Improvement: nan
Total Training Time (s): 0.0004
The reason is because if you make the probabilities to each state equal, and the emissions of each state equal, than the probability of going down any path through the model is equal. This is similar to if you tried to train a k-means model by selecting the same point to be the centroid for each cluster.
If you set each state instead to State(MultivariateGaussianDistribution(np.random.randn(10), np.eye(10)))
, then your model would train, and you'd output like the following:
Original Transition Matrix
[[0. 0. 0. 0. 0.5 0.5 0. 0. ]
[0. 0. 0. 0. 0.5 0.5 0. 0. ]
[0.5 0.5 0. 0. 0. 0. 0. 0. ]
[0.5 0.5 0. 0. 0. 0. 0. 0. ]
[0. 0. 0. 0. 0. 0. 0. 1. ]
[0. 0. 0. 0. 0. 0. 0. 1. ]
[0. 0. 0.5 0.5 0. 0. 0. 0. ]
[0. 0. 0. 0. 0. 0. 0. 0. ]]
[1] Improvement: 286.736450997 Time (s): 0.008253
[2] Improvement: 1.38151676765e-08 Time (s): 0.001807
[3] Improvement: -0.0242289283095 Time (s): 0.001808
Total Training Improvement: 286.712222082
Total Training Time (s): 0.0122
Fitted Transition Matrix
[[0. 0. 0. 0. 0.01589021 0.98410979
0. 0. ]
[0. 0. 0. 0. 0.01589021 0.98410979
0. 0. ]
[0.08566092 0.91433908 0. 0. 0. 0.
0. 0. ]
[0.08566092 0.91433908 0. 0. 0. 0.
0. 0. ]
[0. 0. 0. 0. 0. 0.
0. 1. ]
[0. 0. 0. 0. 0. 0.
0. 1. ]
[0. 0. 0.02393773 0.97606227 0. 0.
0. 0. ]
[0. 0. 0. 0. 0. 0.
0. 0. ]]
Hello, i'm trying to make work a Hidden Markov Model with continuous observations. I try to fit the model using a single sequence of 3 normalized histograms (each histogram is an observation) but it seems not to work, the transition matrix does not change after using fit(). Here is my code.
Any idea of what could i been doing wrong? Thanks in advance.