0
votes

I'm trying to import an arff file into weka and I am continually getting the following error

Unable to determine structure as arff (Reason: java.io.IOException: } expected at end of enumeration, read Token[EOL], line 20

The closing bracket } is present and I can't find any other errors with line 20. In fact the error reappears after I've deleted line 20. I've attached a link to the arff with a couple lines of data: Link

1
Can you post the whole header, from @relation to @data? BTW REAL is outdated and numeric should be used instead. - fracpete
@fracpete Thanks I didn't know that. I've added an image of the file - Michael Howell
Rather than the image, post the header (and a few of the data lines) as text, so I can try to input it. Also upvote this comment so I get a flag in my inbox and remember to try and help you. - zbicyclist
@zbicyclist Thank you I've attached a link to the file. Row 19 has a lot of values so you'll have to scroll a bit. - Michael Howell

1 Answers

0
votes

I see three issues here. FIRST: In the file you linked to, the last attribute is los_category, which is NUMERIC:

@ATTRIBUTE los_category NUMBERIC

But the last variable in your data line is clearly not numeric (Low).

21,22,165315,4/9/2196__12:26:00_PM,4/10/2196__3:54:00_PM,?,EMERGENCY,EMERGENCY_ROOM_ADMIT,DISC-TRAN_CANCER/CHLDRN_H,Private,?,UNOBTAINABLE,MARRIED,WHITE,4/9/2196__10:06:00_AM,4/9/2196__1:24:00_PM,BENZODIAZEPINE_OVERDOSE,0,1,1.144444444,Low

You've defined with @ATTRIBUTE statements 20 variables (lines 3-22) but in fact your data lines have 21 variables.

SECOND, you have time variables (e.g. admittime) as numeric; but they clearly have non-numeric characters. I know there's a specific format that ARFF files want date/time in, but I'm not an expert in that and can't be definitive about a fix. This is definitely a problem, though. When I create a file with just your first 3 variables, it loads fine. When I add the fourth (@ATTRIBUTE admittime NUMERIC) I get the same error as you report.

THIRD, that line 19 (@ATTRIBUTE diagnosis) is hundreds of characters long. You might want to treat that as a STRING variable type for now, just to be sure you aren't overloading the read buffer with that huge line.