1
$\begingroup$

I have a dataset which looks like this:

timestamp  sensor1   sensor2  sensor3  sensor4    sensor5  action
       1    0.05       0.04    0.10      0.39      0.59      A1
       2    0.25       0.14    0.11      0.34      0.59      A2
       3    0.15       0.34    0.13      0.36      0.59      A3
    .......

Since I have the observations (sensor1-sensor5) and the corresponding labels (A1, A2, A3, etc.) for each timestamp, I want to perform supervised learning using a hidden markov model.

Which library could I use to learn the observation distribution and the parameters of the HMM ? Thank you! P.S. : I already took a look at hmmlearn, but it seems to be only for unsupervised learning.

$\endgroup$
1
  • $\begingroup$ Out of curiosity, is there any specific reason for choosing HMM? $\endgroup$
    – Miss.Alpha
    Oct 13, 2022 at 11:27

1 Answer 1

0
$\begingroup$

The libarary pomegranate(https://github.com/jmschrei/pomegranate)implements HMM with Gaussian mixture model. The example of HMM is as follows :

from pomegranate import *
dists = [NormalDistribution(5, 1), NormalDistribution(1, 7), NormalDistribution(8,2)]
trans_mat = numpy.array([[0.7, 0.3, 0.0],
                             [0.0, 0.8, 0.2],
                             [0.0, 0.0, 0.9]])
starts = numpy.array([1.0, 0.0, 0.0])
ends = numpy.array([0.0, 0.0, 0.1])
model = HiddenMarkovModel.from_matrix(trans_mat, dists, starts, ends)
$\endgroup$
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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