1

I am making a sparse arff file but it will not load into Weka. I get the error that I have the wrong number of values in the @attribute class line, it expects 1 and rejects receiving 12. What am I doing wrong? My file looks like this:

%ARFF file for questions data
%

@relation brazilquestions

@attribute att0 numeric
@attribute att1 numeric
@attribute att2 numeric
@attribute att3 numeric
%there are 469 attributes which represent my bag of words
@attribute class {Odontologia_coletiva, Periodontia, Pediatria, Estomatologia,   
Dentistica, Ortodontia, Endodontia, Cardiologia, Terapeutica, 
Terapeutica_medicamentosa, Odontopediatria, Cirurgia}


@data
{126 1, 147 1, 199 1, 56 1, 367 1, 400 1 , Estomatologia}
{155 1, 76 1, 126 1, 78 1, 341 1, 148 1, Odontopediatria}
%and then 81 more instances of data

Any ideas about what is wrong with my syntax? I followed the example exactly from the book Data Mining by Witten/Frank/Hall. Thanks in advance!

4

4 回答 4

1

数据部分的问题。你必须把类属性的索引

例如 :

{126 1, 147 1, 199 1, 56 1, 367 1, 400 1 , 口腔医学}

像下面这样更正它

{126 1, 147 1, 199 1, 56 1, 367 1, 400 1,470 口腔医学}

于 2015-05-30T21:22:37.787 回答
0

在您的文档中,您声明了 5 个属性,但在 @data 中添加了 7 个属性,那么您应该完成 @data 中的其余值。你可以在手册中看到这个

于 2014-06-21T16:35:35.807 回答
0

实例类值的属性名称也需要列出。(请参阅稀疏 ARFF 文件描述。)

你的文件:

@attribute myclass {Odontologia_coletiva, Periodontia, Pediatria, Estomatologia,   
Dentistica, Ortodontia, Endodontia, Cardiologia, Terapeutica, 
Terapeutica_medicamentosa, Odontopediatria, Cirurgia}

@data
{126 1, 147 1, 199 1, 56 1, 367 1, 400 1 , Estomatologia}

应该:

@data
{126 1, 147 1, 199 1, 56 1, 367 1, 400 1 , myclass Estomatologia}
于 2014-12-23T18:20:23.093 回答
0
@ATTRIBUTE class string

尝试使用它而不是

@attribute class {Odontologia_coletiva, Periodontia, Pediatria, Estomatologia,  Dentistica, Ortodontia, Endodontia, Cardiologia, Terapeutica, Terapeutica_medicamentosa, Odontopediatria, Cirurgia}
于 2016-10-11T17:32:57.340 回答