I am currently trying to classify tweets based in sentiment (positive, negative, neutral). I have trained my naive Bayes using a training dataset...
NaiveBayes nb = new NaiveBayes();
nb.buildClassifier(trainingData);
I have tried labelling my unlabelled data using the following code
Instances unlabeled = new Instances(new BufferedReader(new FileReader(
"C:/Users/me/Desktop/unlabelled.ARFF")));
unlabeled.setClassIndex(unlabeled.numAttributes()-1);
//create copy
Instances labeled = new Instances(unlabeled);
for(int i = 0 ; i < unlabeled.numInstances() ; i++) {
double clsLabel = nb.classifyInstance(unlabeled.instance(i));
labeled.instance(i).setClassValue(clsLabel);
}
However I am not getting correct output for example if I declare the class as {positive, negative, neutral} it will always assign positive.
Has anyone any experience on this? I am using weka api in java.