Default Help understanding and implementing percentage split for evaluation using WEKA API

As you can see i am currently using cross validation but since this dataset doesn’t have a test dataset i think it would be a good idea to use percentage split where it would go.

package SpamD_Training;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Random;
import weka.classifiers.Evaluation;
import weka.core.Instances;
import weka.classifiers.bayes.NaiveBayes;
public class NaiveBayesClassifiertestnew
{
static String NaiveBayesModelPath = "/Users/ZiDee/Desktop/Project/Finals/Models/Spambase/NaiveBayes.model";

public static void main(String[] args) throws FileNotFoundException, IOException, Exception { 
BufferedReader breader =null;
breader =new BufferedReader (new FileReader("/Users/ZiDee/Dropbox/Remaining coursework/Dissertation/Report/Program/datasets/spam_dataset.arff"));
Instances train = new Instances (breader);
train.setClassIndex(train.numAttributes()-1);	
///PARAMETERS are set 
breader.close();

String[] options;
NaiveBayes nB = new NaiveBayes();
options = weka.core.Utils.splitOptions("-D");
nB.setOptions(options);
nB.buildClassifier(train);


Evaluation eval = new Evaluation(train );
eval.crossValidateModel(nB, train , 10, new Random(1));
System.out.println("training performance results of: " + nB.getClass().getSimpleName() 
+ "\n---------------------------------");
System.out.println(eval.toSummaryString("\nResults",true));
System.out.println("fmeasure: " +eval.fMeasure(1) + " Precision: " + eval.precision(1)+ " Recall: "+ eval.recall(1));
System.out.println(eval.toMatrixString());
System.out.println(eval.toClassDetailsString());
System.out.println("AUC = " +eval.areaUnderROC(1));
System.out.println("Training complete, please validate trained model");
weka.core.SerializationHelper.write(NaiveBayesModelPath,nB);

}
}

@iarganda is likely the best person here to answer your question. But is this specific to ImageJ? If not, you would be much better off asking the Weka community directly.

2 Likes

There are also a bunch of useful questions and answers with the weka tag on stackoverflow.com, e.g. how to specify split percentage.

3 Likes

Exactly as @imagejan pointed out. I agree with @ctrueden, this question is probably better suited for a Weka forum.

1 Like