0

I am currently trying to covert a csv file of information to an ARFF file in Weka...

The issue pops up that there is a problem with line 3384... but there is nothing that i can see that is wrong with the line?

Image of excel file here

Please can someone help?

Thanks.

1 Answers1

0

This problem often pops up when there are illegal characters in the file to be converted. You can double check for such characters. You can also use the code below to do the conversion from csv to arff in java.

import weka.core.Instances;
import weka.core.converters.ArffSaver;
import weka.core.converters.CSVLoader;

import java.io.File;

public class CsvtoArff {
  public static void main(String[] args) throws Exception {

    String args0="/Users/Kehinde/Documents/trainingtest.csv";
    String args1="/Users/Kehinde/Documents/theoutput.arff";

    // This is used to load CSV
    CSVLoader myloader = new CSVLoader();
    myloader.setSource(new File(args0));
    Instances mydata = myloader.getDataSet();
    System.out.println(mydata);

    // This is used to save ARFF
    ArffSaver mysaver = new ArffSaver();
    mysaver.setInstances(mydata);
    mysaver.setFile(new File(args1));
    mysaver.setDestination(new File(args1));
    mysaver.writeBatch();
  } 
}
Kehinde
  • 16
  • 3