
The AddClassification filter (package ) can either train a classifier on the input data and transform this or load a serialized model to transform the input data (even though the filter was introduced in 3.5.4, due to a bug in the commandline option handling, it is recommended to download a version >3.5.5 or a snapshot from the Weka homepage).

" (the -p option takes the indices of the additional attributes to output). you can also use different output formats, like CSV: -classifications ".prediction.CSV -p.

This works only for explicit train/test sets, but you can use the Explorer for cross-validation. If you have an ID attribute in your dataset as first attribute (you can always add one with the AddID filter), you could output it with -p 1 instead of using -p 0.In this case, "*" is placed beside the probability in the distribution that corresponds to the predicted class value. Since Weka 3.5.4 you can also output the complete class distribution, not just the prediction, by using the parameter -distribution in conjunction with the -p option.The probability that instance 1 actually belongs to class 0 is estimated at 0.757. The error field is empty if predictions were being performed on a labeled test set, each instance where the prediction failed to match the label would contain a "+". The "predicted" column shows that instances 1 through 5 are predicted to be of class 1, whose value is 0, and instance 6 is predicted to be of class 2, whose value is 1. In this case, taken directly from a test dataset where all class attributes were marked by "?", the "actual" column, which can be ignored, simply states that each class belongs to an unknown class.

Sample output: inst# actual predicted error prediction Note that if the actual class label is always "?" (i.e., the dataset does not include known class labels), the error column will always be empty.

Where "+" occurs only for those items that were mispredicted. The format of the output is as follows: : : Sample command line: java 48 -T unclassified.arff -l j48.model -p 0 (Note that if the test class contains simply '?' for the class label for each instance, the "actual" class label for each instance will not contain useful information, but the predicted class label will.) The -T command-line switch specifies the dataset of instances whose classes are to be predicted, while the -p switch allows the user to write out a range of attributes (examples: "1-2" for the first and second attributes, or "0" for no attributes). The output will contain both the actual and predicted class. ClassifiersĪfter a model has been saved, one can make predictions for a test set, whether that set contains valid class values or not. The following sections show how to obtain predictions/classifications without writing your own Java code via the command line.
