Converting an ARFF file to a CSV file

First, let's look at the code. Suppose that we have a weather.arff file. We will first import the following packages:

import weka.core.Instances;import weka.core.converters.ArffLoader;import weka.core.converters.CSVSaver;import;

We have started with the ArffLoader class, and have created an object, loader, for it:

ArffLoader loader = new ArffLoader();

We have then assigned a filename, weather.arff, to the ArffLoader class, as seen in the following code:

loader.setSource(new File("weather.arff")); //Use the path where your file is saved.

We have also called the loader.setSource method and assigned a filename to it by using our File object. Once this is done, we will load this particular dataset ...

Get Hands-On Artificial Intelligence with Java for Beginners now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.