rafaellpontes / jahmm

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

Using jahmm for classification #16

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi all,
I'm using jahmm6.1 in NetBeans IDE 6.9.1 for classification. since I'm new in 
this area I need some hints to use this useful package. I have a dataset which 
is an excel file consisting of 1000 rows that each row has 15 columns(float 
values).I should classify these data into two classes.
I wrote a code to read data from excel file and then try to learn 
KMeansLearner, but I don't know how should I determine the class of each data 
point! However, I know whether each row belings to class1 or 2, I don't know 
how should I learn hmm based on it!
Please let me know your useful hints. It's urgent for me.
This is part of code that I wrote. 

Vector sequences = new Vector();         
           for (int i = 0; i < 20; i++) {               
                 for (int j=0; j<15; j++) 
                     vec[j]=myArray[i][j];                  
               ObservationVector obs=new ObservationVector(vec);
                sequences.add(obs);
            }
KMeansLearner<ObservationVector> kml = new KMeansLearner<ObservationVector>(2, 
new OpdfMultiGaussianFactory(1000) , sequences);
            hmm = kml.learn(); 
BaumWelchLearner  bwl = new BaumWelchLearner ();
       hmm= bwl.learn(hmm, sequences);
for(int i = 0; i < 20; i++) {
        hmm = bwl.iterate(hmm, sequences);
    }

It gave me an error like this:
Exception in thread "main" java.lang.ClassCastException: 
be.ac.ulg.montefiore.run.jahmm.ObservationVector cannot be cast to 
java.util.List
        at be.ac.ulg.montefiore.run.jahmm.learn.KMeansLearner.flat(KMeansLearner.java:198)
        at be.ac.ulg.montefiore.run.jahmm.learn.KMeansLearner.<init>(KMeansLearner.java:48)

thanks a lot. 

Original issue reported on code.google.com by zahra.ha...@gmail.com on 20 Dec 2010 at 4:22