"Nominal value not declared in header"

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

"Nominal value not declared in header"

JesseBoz
Hi,


I am complete beginner using weka and I'm having some problems trying to
open my data set. I am attempting to open a CSV file with weka so that I can
convert it to an ARFF file and when I open it I receive an error that says
'wrong number of values. read 4, expected 15..'. I determined this error to
be a problem with attributes that had apostrophes (neighbourhood names) and
once I removed the apostrophe from the enclosure characters on the
converter, this error disappeared.

The error that appears after this reads 'nominal value not declared in
header  ,read token ['2017S008429], line 1'.

I have tried everything to fix this from writing a manual ARFF file, reading
forums etc but I cannot find the solution.

The first two lines of the text file (CSV) look like this:

Id,District Name,Neighborhood Name,Street,Weekday,Month,Day,Hour,Part of the
day,Mild injuries,Serious injuries,Victims,Vehicles
involved,Longitude,Latitude
2017S008429    ,Unknown,Unknown,Número 27    
,Friday,October,13,8,Morning,2,0,2,2,2.12562442,41.34004482

Thanks!







--
Sent from: http://weka.8497.n7.nabble.com/
_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: "Nominal value not declared in header"

Henry Gouk
It could be because the buffer size used to estimate what values nominal attributes can take is not large enough to see all the different possible values. If you're using Linux/Max, try running this from the command line:

java weka.core.converters.CSVLoader INPUT.csv -H -B `wc -l INPUT.csv` > OUTPUT.arff

Where INPUT.csv and OUTPUT.arff are changed appropriately. This will load the CSV file, and also set the buffer size to be the same length as the input file instead of the default (100, I think), and write the resulting ARFF file out to OUTPUT.arff.



On Sun, Jan 13, 2019 at 10:57 AM JesseBoz <[hidden email]> wrote:
Hi,


I am complete beginner using weka and I'm having some problems trying to
open my data set. I am attempting to open a CSV file with weka so that I can
convert it to an ARFF file and when I open it I receive an error that says
'wrong number of values. read 4, expected 15..'. I determined this error to
be a problem with attributes that had apostrophes (neighbourhood names) and
once I removed the apostrophe from the enclosure characters on the
converter, this error disappeared.

The error that appears after this reads 'nominal value not declared in
header  ,read token ['2017S008429], line 1'.

I have tried everything to fix this from writing a manual ARFF file, reading
forums etc but I cannot find the solution.

The first two lines of the text file (CSV) look like this:

Id,District Name,Neighborhood Name,Street,Weekday,Month,Day,Hour,Part of the
day,Mild injuries,Serious injuries,Victims,Vehicles
involved,Longitude,Latitude
2017S008429    ,Unknown,Unknown,Número 27     
,Friday,October,13,8,Morning,2,0,2,2,2.12562442,41.34004482

Thanks!







--
Sent from: http://weka.8497.n7.nabble.com/
_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: "Nominal value not declared in header"

Michael Hall
In reply to this post by JesseBoz

> On Jan 11, 2019, at 4:06 PM, JesseBoz <[hidden email]> wrote:
>
>
>
> The error that appears after this reads 'nominal value not declared in
> header  ,read token ['2017S008429], line 1'.
>
>
> involved,Longitude,Latitude
> 2017S008429    ,
>
>

Since it seems to be objecting to a specific token in the first line I might think something is wrong in the conversion formatting.
Your print also seems to show maybe an embedded new line and maybe some other trailing invisible characters for that token.
If you have a text editor that will show these special characters or something that will hex dump the file maybe you could tell from that.
Or attach the arff to an email and someone else might be able to check.

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html