I already checked in the WEKA documentation and contained explicit instructions for command line and GUI predictions.
I want to know how to get a prediction value like the one below that I got from the GUI using the dataset Agrawal( weka.datagenerators.classifiers.classification.Agrawal) in my own Java code:
inst#, actual, predicted, error, prediction
1, 1:0, 2:1, +, 0.941
2, 1:0, 1:0, , 1
3, 1:0, 1:0, , 1
4, 1:0, 1:0, , 1
5, 1:0, 1:0, , 1
6, 1:0, 1:0, , 1
7, 1:0, 2:1, +, 0.941
8, 2:1, 2:1, , 0.941
9, 2:1, 2:1, , 0.941
10, 2:1, 2:1, , 0.941
1, 1:0, 1:0, , 1
2, 1:0, 1:0, , 1
3, 1:0, 1:0, , 1
I cannot reproduce this result, although he said that:
Java
If you want to perform the classification in your own code, see the section on classifying instances in this article , explaining the Weka API in general.
I went to the link and said:
Instance classification
, , . /some/where/unlabeled.arff, /some/where/labeled.arff.
, , -- , .
Update
predictions
public FastVector predictions()
.
:
FastVector, , . , .
predictions() Evaluation :
Object[] preds = evaluation.predictions().toArray();
for(Object pred : preds) {
System.out.println(pred);
}
:
...
NOM: 0.0 0.0 1.0 0.9466666666666667 0.05333333333333334
NOM: 0.0 0.0 1.0 0.8947368421052632 0.10526315789473684
NOM: 0.0 0.0 1.0 0.9934883720930232 0.0065116279069767444
NOM: 0.0 0.0 1.0 0.9466666666666667 0.05333333333333334
NOM: 0.0 0.0 1.0 0.9912575655682583 0.008742434431741762
NOM: 0.0 0.0 1.0 0.9934883720930232 0.0065116279069767444
...
, ?