2
$\begingroup$

I am trying to reproduce the results of this paper, but using python and the HMMlearn library instead of matlab. The paper describes a procedure for using HMM (Hidden Markov Model) in order to predict stock prices.

The paper details the use of a 4-state, 5-mixture Gaussian distribution as the model. The transition probabilities and the initial state probabilities are uniform, however the emission probabilities are determined based on the results of a k-means algorithm using the data-set of existing stock prices.

This latter part is where I have gotten stuck, the paper advises to use the means, variance and weight of each cluster returned from the k-means algorithm as the mean, variance and weight of each component of the mixture. As I understand it the mean of the cluster is simply the center of each centroid, however I'm not sure how you would obtain the variance or the weight.

TL;DR Given a 3 dimensional dataset X (in the form [[a, b, c], [d, e, f]...]) and using the k-means algorithm where k = 5 (k = number of mixture components), how would I determine the weight and variance of each cluster?

$\endgroup$
1
$\begingroup$

It is valid to use the k-means to initialize the EM for Mixture of Gaussian modeling. As you said, the mean of each component will be the average of all samples belong to the same cluster (it depends on the used clustering algorithm, some times the centroid is not the average of the cluster but is one of the samples). for the weight you can use the following: the weight of cluster x = the number of samples belong to cluster x divided by the total number of samples. thus, the cluster with the highest number of samples is the cluster with the highest weight. for the variance: just find the variance of all samples belong to the same cluster.

$\endgroup$
1
  • $\begingroup$ I had a hunch this was the way to go, thank you for confirming! $\endgroup$ – Dider Apr 28 '16 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.