Reputation: 1
I am using the python pomegranate library and I am initializing an hmm model using the method from_sample
. I have multivariate time series data - with different observed variables (a, b, c) per timepoint t. According to the pomegranate documentation, I am passing the data as a list of numpy arrays where the rows are different timepoints and the columns are features/observed variables.
array = numpy.array([[t1a, t1b, t1c], [t2a, t2b, t2c])
model = HiddenMarkovModel.from_samples(MultivariateGaussianDistribution, n_components=20, X=array)
I am using "sample" to generate data from the model.
samples = model.sample(length = 5)
As far as I understood, the sequence generated with this method should be a list of emitted items - but in the example above "samples" contains 5 lists, each with only one element. But I meant to do a multivariate hmm - with three emitted variables per timepoint. Then, why does "samples" not contain lists with each three variables too? What am I doing wrong?
I would really appreaciate any help and feedback on this!
Thank you very much in advance.
I have searched the questions/issues here and in the pomegranate documentation... But I could not find a solution.
Upvotes: 0
Views: 150
Reputation: 11
I think that the error here is that when using the "sample" method to generate data by using model.sample(lenght=5). You are generating 5 seperate sequences that aren't connected. Rather than arrays, samples should be defined containing ([[t1a, t1b, t1c], [t2a, t2b, t2c]) This way it is register as as the same sequence rather than 5 seperate sequences.
I have attached a linked to another stackoverflow question that uses similar commands and programs. Sample from a Bayesian network in pomegranate
Upvotes: 1