无法确定WEKA中的arff结构



我通过将文件保存在ANSI中并删除第一行并将属性更改为数字而不是实数,甚至在第29行添加'}'符号,在线尝试了提出的解决方案,但当我尝试导入arff文件时,我仍然在WEKA中得到以下错误。

错误信息:

无法确定结构为arff(原因:java.io. xml)。IOException:} expected at end of enumeration, read Token[EOL],line 29)

ARFF文件:

@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
}

请通知…谢谢你。

  • Arff不需要在属性段或数据段的末尾使用结束手环。所以去掉它们。
  • 属性名必须以字母开头
  • 如果标称值包含空格,则必须引用,例如这里的性别值,24#属性需要引用,即。男性(Lelaki)。
  • 请检查属性名称和属性数据类型之间是否需要空格,即使是标称值。
  • 还要确保每行数据输入由等于属性部分中指定的属性数量的值组成。
  • 如果上述点无法消除错误,请检查arff文件格式的详细信息http://www.cs.waikato.ac.nz/ml/weka/arff.html

下次考虑编辑你的问题,而不是在答案中写问题。


问题是您应该将属性23和24处的Don't_knowDon't know更改为Dont_know。这意味着你必须跳过标点和空格。

您还需要将@attribute Gender? { Male(Lelaki),Female(Perempuan) }更改为@attribute Gender? { Male,Female }

或者你的数据应该是这样的Male(Lelaki),36,2,3,Nothing_to_Carry,1,3,...而不是Male,36,2,3,Nothing_to_Carry,1,3...

尝试从Weka Software打开。csv文件数据集。

它有一些步骤要做

  1. 通过安装Weka软件,进入"Experimenter"标签
  2. 然后转到"analyze"标签
  3. 然后选择通过"file"打开。csv数据集选择
  4. 然后点击"打开浏览器"按钮
  5. 然后将打开的输出保存为。arff格式,名称为然后关闭Weka软件7.然后再次打开Weka软件,进入"浏览器"。标签然后从打开先前保存的。arff格式数据集

之后就不会出现这种类型的错误。您可以使用Weka软件轻松地进行预处理,分类,关联规则。

最新更新