Search code examples
machine-learningweka

How to evaluate an updateable classifier in Weka


I'm using the Weka API to implement an incremental classifier following the steps in http://weka.wikispaces.com/Use+Weka+in+your+Java+code

However, I do not find any option to evaluate the classifier (using a test set) since the only documentation is using small datasets (which I don't have, that's why I'm using an updateable classifier). Are there any updateable evaluation available? Or the only way is doing it manually?

Thanks for the help!


Solution

  • Any classifier in WEKA can be tested using a Evaluation object like so:

    Evaluation eTest = new Evaluation(testInstances);
    eTest.evaluateModel(yourUpdatableModelHere, testInstances);
    //Print the results
    System.out.println(eTest.toSummaryString());
    //Get the confusion matrix
    double[][] confMatrix = eTest.confusionMatrix();
    

    For more, see the JavaDoc on Evaluation here.