I'm training HMMs implemented in JaHMM with sensor data from an accelerometer and a gyroscope obtained from an Android wearable.
The HMM trained with accelerometer data outputs fine learned states, and has a somewhat acceptable error rate.
Both HMM's is initialized as follows:
Hmm<ObservationVector> hmm = new Hmm<>(2, new OpdfMultiGaussianFactory(3));
hmm.setPi(0, 0.5);
hmm.setPi(1, 0.5);
hmm.setOpdf(0, new OpdfMultiGaussian(
new double[]{0,0,0},
new double[][] {{0.1,0,0},
{0,0.1,0},
{0,0,0.1}
}));
hmm.setOpdf(1, new OpdfMultiGaussian(
new double[]{0,0,0},
new double[][] {{0.1,0,0},
{0,0.1,0},
{0,0,0.1}
}));
hmm.setAij(0, 0, 0.5);
hmm.setAij(0, 1, 0.5);
hmm.setAij(1, 0, 0.5);
hmm.setAij(1, 1, 0.5);
Output for HMM trained with accelerometer data:
HMM with 2 state(s)
State 0 Pi: 0.5000000000000188 Aij: 0.5 0.5 Opdf: Multi-variate Gaussian distribution --- Mean: [ 0.036 -0.051 0.075 ]
State 1 Pi: 0.5000000000000188 Aij: 0.5 0.5 Opdf: Multi-variate Gaussian distribution --- Mean: [ 0.036 -0.051 0.075 ]
However, the HMM trained with gyroscope data can't seem to learn the states of the HMM no mater how many training iterations I've tried (500 iterations). The e.g. learned state probabilities is just NaN
Output for HMM trained with gyroscope data:
HMM with 2 state(s)
State 0 Pi: NaN Aij: ? ? Opdf: Multi-variate Gaussian distribution --- Mean: [ ? ? ? ]
State 1 Pi: NaN Aij: ? ? Opdf: Multi-variate Gaussian distribution --- Mean: [ ? ? ? ]
What could be the cause for this behavior? Is there a preprocessing or normalize step i need to perform before the data is usable in the HMM? Is the number of states in the HMM that is insufficient? I've tried with five states, but it yields the same result.
A snippet of the training file for accelerometer can be seen here: https://gist.github.com/Gudui/91d2c6b2452f1ea6a5c925b1eed9b40c
A snippet of the training file for gyroscope can be seen here: https://gist.github.com/Gudui/987cc1c1a7c0311a03988b818e7cbbcb
For both training files, each line represent a training sequence.
The library is available here: https://github.com/tanjiti/jahmm
Thanks in advance!