Data Preparation
Weka uses the arff file type.
A modified example arff file content from the previous link:
% 1. Title: Iris Plants Database
% 2. Creator: R.A. Fisher, Donor: Michael Marshall (MARSHALL%[email protected])
@RELATION iris
@ATTRIBUTE petallength NUMERIC
@ATTRIBUTE petalwidth NUMERIC
@ATTRIBUTE class {Iris-setosa,Iris-versicolor,Iris-virginica}
@DATA
1.4,0.2,Iris-setosa
1.4,0.2,Iris-virginica
1.3,0.2,Iris-setosa
1.5,0.2,Iris-versicolor
1.4,0.2,Iris-setosa
1.7,0.4,Iris-setosa
The above example can be broken down into sections:
- Comments
- Lines beginning with "%" are comments and are not read by the WEKA data readers
- @RELATION
- dataset name (use quotes around the name if there are spaces)
- @ATTRIBUTE
- each attribute defines a feature of one of the following types:
- NUMERIC: real number
- NOMINAL: discrete value from a predefined list (see example @ATTRIBUTE class feature)
- STRING: a string where quotes must be used if spaces are included
- DATE: @ATTRIBUTE `name` date [`date-format`] where the default date-format is "yyyy-MM-dd'T'HH:mm:ss"
- @DATA
- Delimiter specifying the start of the CSV data
Weka Explorer
After creating your arff file, you have a few options when using the Weka explorer:
- Load entire dataset into Weka explorer and use the built-in k-fold cross validation option which randomly partitions your dataset and automatically performs CV for your given a classifier
- Load entire dataset into Weka explorer and use the built-in train/test split option with a user-specified percentage to randomly partition your dataset.
- Manually partition your arff file into a train file and test file and use the supplied test-set option in the Weka explorer. To manually partition your arff file, simply copy your original arff file and and keep non-intersecting sets of CSV rows (i.e. delete instances from one file and retain those instances in the other).
If this is for educational purposes, it might be easiest to manually partition your dataset so that you know which images are in training and which are testing. If this is for research, of course k-fold CV is preferred.
If you are using the Weka Java library rather than the desktop application, there are plenty of online resources that explain the library architecture: Waikato Github io site