I have a Csv file download from http://yann.lecun.com/exdb/mnist/index.html. I need to convert it to arff file format.
I tried running
java weka.core.converters.CSVLoader /home/saket/Documents/Assignment/NIST7000 > /home/saket/Documents/Myfile.arff
but it's giving following error
java.lang.IllegalArgumentException: Attribute names are not unique! Causes: '0' '0' '0' '0' '0' '0' '0'
Then I tried using http://weka.wikispaces.com/Converting+CSV+to+ARFF java code. BUt still same error came.
Can someone please suggest what i am doing wrong
Save your dataset in ARFF format by clicking the “File” menu and selecting “Save as…”. Enter a filename with a . arff extension and click the “Save” button.
Arff FormatThe @relation tag defines the name of the database. The @attribute tag defines the attributes. The @data tag starts the list of data rows each containing the comma separated fields.
One simple way to do this is in version 3.6. 11 (I'm on a mac) is to open up the Explorer and then in the Preprocess tab select "Open file...", just as you would when you want to open a . arff file. Then where it asks for the File Format at the bottom of the dialog box, change it to .
There was no header fields in the csv. So I created a script and added column0,column1,...,class in the Csv file first line. Then opened that generated csv file in weka.
I have encountered the same exception but with a different reason. I used "class" as the attribute name, but this word also appeared in my data as a string (after @data) and Weka did not correctly separate attribute and data. Solved by simply renaming "class" attribute to something else like "s_label".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With