I'm working on a Web Service writen in Java to use Weka algorith j48 to classify some atributes. First it builds the classifier and then it classifies an instance using the classifier tree.
This is part of the code i have for the classifydata method
fc.buildClassifier(train);
for (int i = 0; i < test.numInstances(); i++)
{
double pred = fc.classifyInstance(test.instance(i));
predicated = (test.classAttribute().value((int) pred));
}
being fc the FilteredClassifier that was previously set, being train the data used to build the classifier and test the instance to classify I'm also not sure if with this code i'm doing a good classification, if you could confirm that it would be nice.
What i really want is to get the "accuracy percentage". I don't really know if it is called like this but i don't know how else to reffer to it. Basicly i want something that will return the accuracy percentage of the classify result. Imagine i have simple a tree that has only 2 classifications, "1" or "2". Imagine i classify an instance and the result is "2". Now i want something that will return how accurate it is for the instance to be a "2", and who says accuracy says probability of being really a "2"
I hope i made myself clear because this is kinda new to me aswell