Weka Predictions to CSV

25,219

Solution 1

I assume you use Weka's Explorer. In the Classify tab click on More options..., then click on Output predictions and select CSV. Now click on the box showing CSV and a window opens where you can fill in the properties of writing to a CSV file. Click on outputFile and select a folder and type a filename (note: you must supply a filename). Running a new test will now save the prediction results to your CSV file.

Solution 2

In Weka 3.6.x you can right-click your model, choose "Visualize classifier errors" and Save the data (including the prediction) from there.

Solution 3

If you use weka knowledge flow to build models (Easier than explorer), there are CSV data sinks you can use to save as CSV file.

Share:
25,219
elliottbolzan
Author by

elliottbolzan

iOS and OS X app designer.

Updated on May 17, 2020

Comments

  • elliottbolzan
    elliottbolzan about 4 years

    I've trained a classifier in Weka, and I'm able to use it on test data. Additionally, I can opt to display the classifier's predictions in the log window for this test data.

    However, for my current project, it would be convenient for me to be able to get this data in CSV format. Is this possible in Weka ? Is it only possible when using the command line (something I'll eventually move towards) ?

    I could always save the entire buffer result to a text file, but in that case, I would have to parse the file and remove all the "noise" (which isn't really noise, but you get the point).

    So, to conclude, is there any way to output Weka's predictions for a test set to a CSV file ?

    Edit: as the answer below shows, there is an option to do this. However, it can only be found in Weka 3.7 and above !

  • Admin
    Admin over 10 years
    Thank you! The official documentation never mentioned the part where one can actually find the predictions.
  • Haja Maideen
    Haja Maideen almost 10 years
    This have little overhead, open .arff file, remove the headers, save the file and import it in execel