【问题标题】:Unable to determine structure as arff in WEKA无法在 WEKA 中将结构确定为 arff
【发布时间】:2017-01-06 07:12:24
【问题描述】:

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

错误信息:

无法将结构确定为 arff(Reason:java.io.IOException: } 预期在枚举结束时,读取 Token[EOL],第 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

}

请指教...谢谢。

【问题讨论】:

    标签: attributes weka arff


    【解决方案1】:
    • Arff 不需要在属性部分或数据部分的末尾关闭手链。所以删除它们。
    • 属性名称必须以字母字符开头。
    • 如果名义值包含空格,则必须引用它们,例如此处的性别值,需要引用 24# 属性,即“男性 (Lelaki)”。
    • 请检查是否需要在属性名称和属性数据类型之间留出空格,即使对于标称值也是如此。
    • 还要确保每行数据输入包含的值数量等于属性部分中指定的属性数量。
    • 如果以上几点未能消除错误,请在http://www.cs.waikato.ac.nz/ml/weka/arff.html查看arff文件格式详细信息

    【讨论】:

    • 感谢您的反馈@Dipawesh-Pawar。做完这一切后我仍然找不到问题。但是,我仍然收到以下错误:PIlot.arff 未识别为“Arff 数据文件”文件。原因:无法将结构确定为 arff(原因 'java.io.IOException': } 预期在枚举结束时,读取 Token [EOL],第 29 行)
    【解决方案2】:

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


    问题是您应该将属性 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...

    【讨论】:

      【解决方案3】:

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

      它有一些步骤要做

      1. 通过安装 Weka 软件并转到“Experimenter”选项卡
      2. 然后转到“分析”选项卡
      3. 然后选择.csv数据集通过“文件”选项打开它
      4. 然后点击“打开资源管理器”按钮
      5. 然后将打开的输出保存为 .arff 格式并命名
      6. 之后关闭Weka软件 7.然后再次打开Weka软件,进入“资源管理器”标签
      7. 然后从中打开之前保存的 .arff 格式数据集

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-11-09
        • 1970-01-01
        • 1970-01-01
        • 2017-12-09
        • 2014-05-14
        • 2020-12-19
        • 2012-05-07
        • 2016-12-13
        相关资源
        最近更新 更多