Unable to determine structure as arff in WEKA

Jay picture Jay · Aug 30, 2016 · Viewed 7k times · Source

I tried the proposed solutions online by saving the file in ANSI and deleting the first line and changing the attributes to numeric instead of real as follows and even by adding a '}' symbol at the line 29 but I still get the following error in WEKA when I try to import the arff file.

Error Message:

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

ARFF file:

@relation Pilot

@attribute Gender? { Male (Lelaki),Female (Perempuan) }
@attribute Age? numeric
@attribute 1# numeric
@attribute 2# numeric
@attribute 22#{Nothing_to_Carry,Need_to_carry_many_things}
@attribute 14# numeric
@attribute 3# numeric
@attribute 18# numeric
@attribute 17# numeric
@attribute 4# numeric
@attribute 5# numeric
@attribute 15# numeric
@attribute 16# numeric
@attribute 19# {No,Yes}
@attribute 20# {Yes,No}
@attribute 6# numeric
@attribute 7# numeric
@attribute 8# numeric
@attribute 9# numeric
@attribute 11# numeric
@attribute 10# numeric
@attribute 12# numeric
@attribute 13# numeric
@attribute 21#{No,Yes}
@attribute Physical_Disability{Partially_Visually_Impaired,Blind}
@attribute 23#{Yes,Don't_know,No}
@attribute 24#{No,Don't know,Yes}
@attribute 25#{Yes,No}
}

@data
Male,36,2,3,Nothing_to_Carry,1,3,2,3,3,2,1,2,No,Yes,3,5,5,4,5,4,3,3,No,Partially_Visually_Impaired,Yes,No,Yes
Female,44,3,3,Nothing_to_Carry,3,4,3,3,4,3,1,1,No,Yes,4,4,3,2,3,3,4,4,No,Partially_Visually_Impaired,Yes,No,Yes
Male,34,3,4,Nothing_to_Carry,3,3,2,1,4,3,2,1,No,Yes,1,4,3,1,5,3,4,5,No,Blind,Yes,Don't know,Yes
Male,56,1,3,Nothing_to_Carry,3,4,4,4,4,3,3,3,No,Yes,1,5,5,5,3,3,5,1,Yes,Blind,Don't know,Yes,Yes
Male,54,5,5,Nothing_to_Carry,1,1,1,5,5,5,1,5,No,Yes,1,5,5,1,5,1,1,5,Yes,Blind,Yes,No,Yes
Female,39,1,1,Nothing_to_Carry,1,2,1,5,3,5,5,5,Yes,Yes,3,3,5,1,1,5,5,5,Yes,Blind,Yes,Yes,Yes
Male,49,2,3,Nothing_to_Carry,2,2,3,4,4,4,3,3,No,Yes,1,3,3,4,3,3,4,4,No,Partially_Visually_Impaired,No,No,Yes
Male,68,5,4,Nothing_to_Carry,4,4,2,5,2,3,3,3,No,No,1,2,3,1,3,3,3,4,No,Blind,Yes,Don't know,No
Male,44,1,1,Nothing_to_Carry,1,3,3,3,3,3,3,1,No,Yes,1,5,4,4,3,4,2,2,Yes,Blind,Yes,Yes,Yes
Male,45,1,1,Nothing_to_Carry,1,2,1,1,1,1,3,1,No,Yes,5,5,1,5,5,5,5,5,No,Partially_Visually_Impaired,No,No,Yes
Male,59,3,4,Nothing_to_Carry,4,3,3,3,3,3,3,3,No,No,2,1,3,1,4,3,4,2,No,Blind,Yes,Yes,No
Male,38,3,3,Nothing_to_Carry,4,4,3,4,4,3,3,3,No,Yes,4,2,4,1,2,3,3,3,No,Partially_Visually_Impaired,Yes,No,Yes
Male,29,4,2,Nothing_to_Carry,4,4,4,4,3,4,4,3,Yes,Yes,4,3,3,3,3,3,4,3,No,Blind,Yes,No,Yes

}

Please advise...Thank you.

Answer

drp picture drp · Aug 30, 2016
  • Arff don't need closing bracelet at the end of attribute section or data section. So remove them.
  • Attribute name must start with an alphabetic character.
  • If nominal values contains space then they must be quoted e.g here values of gender, 24# attributes needs to be quoted i.e. 'Male (Lelaki)'.
  • Please check whether space needs to be given in between attribute name and attribute datatype even for nominal values.
  • Also make it sure that each line of data input consists of number of values equal to number of attributes specified in attribute section.
  • If above points fail to remove error please check arff file format details at http://www.cs.waikato.ac.nz/ml/weka/arff.html