wengcaisheng / jahmm

Automatically exported from code.google.com/p/jahmm
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ArrayIndexOutOfBoundsException in KMeansLearner.learn method #32

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm newbie with Jahmm and I've tried to implement a HMM that recieve a list of 
sequences corresponding to a trajectory. Each value are compound for 4 
variables: x, y, and dx,xy (velocity vector).

The output states are 2: Right and Left.

I have an ArrayIndexOutOfBoundsException exception in the learn method of 
KMeansLearner:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 330
    at be.ac.ulg.montefiore.run.jahmm.OpdfInteger.fit(OpdfInteger.java:116)
    at be.ac.ulg.montefiore.run.jahmm.learn.KMeansLearner.learnOpdf(KMeansLearner.java:165)
    at be.ac.ulg.montefiore.run.jahmm.learn.KMeansLearner.iterate(KMeansLearner.java:67)
    at be.ac.ulg.montefiore.run.jahmm.learn.KMeansLearner.learn(KMeansLearner.java:96)
    at Detector.main(Detector.java:97)

This is the code:

int inputStates = 4;
        KMeansLearner kmeansRight = new KMeansLearner(inputStates, new OpdfIntegerFactory(inputStates), obsSequenceRight);
        Hmm derHMM = kmeansRight.learn();

        KMeansLearner kmeansLeft = new KMeansLearner(inputStates, new OpdfIntegerFactory(inputStates), obsSequenceLeft);
        Hmm izqHMM = kmeansLeft.learn();

        List<List<Integer>> lsTest = detector.leerDirectorio(filename);
        for (int i = 0; i < lsTest.size(); i++) {
            double derProb = derHMM.probability(lsTest);
            double izqProb = izqHMM.probability(lsTest);
        }

Thanks for the help.

Original issue reported on code.google.com by AaLiYaH...@gmail.com on 11 Jan 2015 at 4:34