Weka APIs

References:

Filters

weka.filters.unsupervised.attribute.Remove

Remove specified attributes (columns)

http://weka.sourceforge.net/doc.stable/weka/filters/unsupervised/attribute/Remove.html

Valid options are:

 -R <index1,index2-index4,...>
  Specify list of columns to delete. First and last are valid
  indexes. (default none)

-V Invert matching sense (i.e. only keep specified columns)

Instances

public Instances trainCV(int numFolds, int numFold)

This function split the training dataset for cross-validation. It does not randomize the input dataset before splitting.

 

public Instances trainCV(int numFolds, int numFold, java.util.Random random)

This function only randomizes the dataset after splitting.

Save Dataset

 ArffSaver saver = new ArffSaver();
 saver.setInstances(dataSet);
 saver.setFile(new File("./data/test.arff"));
 saver.setDestination(new File("./data/test.arff"));   // **not** necessary in 3.5.4 and later
 saver.writeBatch();
 https://weka.wikispaces.com/Save+Instances+to+an+ARFF+File