Arff File - Nominal Value not declared in header.

srrvnn picture srrvnn · Mar 15, 2013 · Viewed 18.4k times · Source

I am generating an .arff file using a Java program. The file has about 600 attributes.

I am unable to open the file in Weka Explorer. It says: "nominal value not declared in header, read Token[0], line 626."

Here is the first attribute line: @attribute vantuono numeric
Here are the first few chars of line 626: 0,0,0,0,1,0,0,0,0,1,0,1...

Why is WEKA unable to parse '0' as a numeric value?

Interestingly, this happens only in this file. I have other files with numeric attributes accepting '0' for a value.

Answer

Sentry picture Sentry · Mar 16, 2013

Are you sure that your declaration is correct? The WEKA FAQ says:

nominal value not declared in header, read Token[X], line Y

If you get this error message than you seem to have declared a nominal attribute in the ARFF header section, but Weka came across a value ("X") in the data (in line Y) for this particular attribute that wasn't listed as possible value. All nominal values that appear in the data must be declared in the header.

There is also a bug regarding sparse ARFF files