prometheuspk
prometheuspk

Reputation: 3815

How to get results from WEKA

I understand how to use WEKA APIs I first load the arff into the program which creates Instances. These will then be given to a Classifier that has been trained on this Dataset. Now I want to give it a new test dataset without a label and make the WEKA API tell me what the label for that instance is or may be. How is that done?

Upvotes: 0

Views: 3805

Answers (2)

Rushdi Shams
Rushdi Shams

Reputation: 2423

Your training and test instances should look exactly the same.

feature value 1, feature value 2......., feature value n, class value feature value 1, feature value 2......., feature value n, class value

When you are applying your model on your test set, Weka will not provide your model the class value of the instances. Rather it will ask, "hey, classifier, let me see how you assign classes to each of the test instances as you learned from training set". Then the classifier model assigns each test instance a class from what it learned from training set. Weka then compares it and provides result in terms of precision, recall, f-score, ROC, AUC, errors, etc. So, in summary, your test instance will have the class values. Don't exclude that. Otherwise, you will get an error like "training and test sets are incompatible".

Upvotes: 0

daveb
daveb

Reputation: 76171

You use Classifier.classifyInstance(Instance)

http://weka.sourceforge.net/doc/weka/classifiers/Classifier.html

Upvotes: 2

Related Questions