mominbuet / jahmm

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

KMeansLearner taking inordinately long #14

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

I want to train a HMM with ObservationVector of size 9, sequence of size 5, 
sequeces of size 500 and no of states =10. 

example ObservationVector :
{1.377,10.0,0.0,301.5,1214.5685016666664,315203.6001666666,3.5076600116666667,20
.395,415.0},
{1.158,10.0,0.0,381.9,1214.5180483333336,345942.0825000001,3.950539710000001,20.
7745,415.0},
{0.972,10.0,0.0,321.6,1207.6763050000002,348111.70533333323,5.423664218333333,21
.9235,415.0},
{1.223,10.0,0.0,321.6,1211.0414300000002,348027.776,5.535122003333333,22.4065,41
5.0},
{1.062,10.0,0.0,381.9,1214.4290457627121,347750.5875,5.732363891666665,23.017,41
5.0},
{0.764,10.0,0.0,405.0,1212.8318266666668,355970.02233333327,5.565356888333333,22
.0345,415.0},
{0.643,10.0,0.0,425.25,1212.933148333333,356178.29949999996,5.563183511666667,22
.0185,415.0},
{0.726,10.0,0.0,344.76,1214.2682116666667,355337.1081666666,5.6176908999999995,2
1.884,415.0},
{0.875,10.0,0.0,405.6,1213.3473783333336,352905.9781666667,5.613016170000001,22.
504,415.0},
{0.806,10.0,0.0,365.04,1213.3571433333332,348112.71266666666,5.706252395000002,2
2.6875,415.0},
{0.75,10.0,0.0,385.32,1214.16201,355867.2406666667,5.5668656883333325,22.8065,41
5.0},
{0.617,10.0,0.0,384.18,1213.9854100000007,356745.9403333332,5.529165541666666,22
.4415,415.0},
{0.595,10.0,0.0,408.0,1213.674531666667,356314.3568333333,5.576403996666668,22.2
145,415.0},

The program virtually hangs after printing numberOfHiddenStates: 10.

please help.
====
public Hmm<ObservationVector> learnHMM(List<List<ObservationVector>> sequences) 
{
        int numberOfHiddenStates = 10;
        Hmm<ObservationVector> trainedHmm = null;
        do {
            System.out.println("numberOfHiddenStates: "+numberOfHiddenStates);
            KMeansLearner<ObservationVector> kml = new KMeansLearner<ObservationVector>(numberOfHiddenStates,
                    new OpdfMultiGaussianFactory(obsVectorSize), sequences);
            trainedHmm = kml.learn();
            BaumWelchLearner bwl = new BaumWelchLearner();
            bwl.setNbIterations(20);
            trainedHmm = bwl.learn(trainedHmm, sequences);
            numberOfHiddenStates++;
        } while (Double.isNaN(trainedHmm.getPi(0)) && numberOfHiddenStates< 20);

        return trainedHmm;
    }

Original issue reported on code.google.com by asutosh....@gmail.com on 1 Oct 2010 at 4:46

GoogleCodeExporter commented 9 years ago
it does work on my PC (but eclipse looks frozen for a second), what hardware 
are you running on?

Original comment by vamos.be...@gmail.com on 2 Oct 2010 at 3:07