// test set
String filename = createFilename(train);
File file = new File(filename);
if (!file.exists())
throw new WekaException("Test set '" + filename + "' not found!");
Instances test = DataSource.read(filename);
// can we set the class attribute safely?
if (train.numAttributes() == test.numAttributes())
test.setClassIndex(train.classIndex());
else
throw new WekaException(
"Train and test set (= " + filename + ") "
+ "differ in number of attributes: "
+ train.numAttributes() + " != " + test.numAttributes());
// test headers
if (!train.equalHeaders(test))
throw new WekaException(
"Train and test set (= " + filename + ") "
+ "are not compatible:\n"
+ train.equalHeadersMsg(test));
try {