Skip to content

Instantly share code, notes, and snippets.

@FernandoCutire
Last active July 18, 2024 18:55
Show Gist options
  • Save FernandoCutire/9471612717eff6b6634481d2d6841c5a to your computer and use it in GitHub Desktop.
Save FernandoCutire/9471612717eff6b6634481d2d6841c5a to your computer and use it in GitHub Desktop.
import weka.core.converters.ConverterUtils.DataSource;
...
DataSource source = new DataSource("/some/where/data.arff");
Instances data = source.getDataSet();
// setting class attribute if the data format does not provide this information
// For example, the XRFF format saves the class attribute information as well
if (data.classIndex() == -1)
data.setClassIndex(data.numAttributes() - 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment