HMdeveloper
HMdeveloper

Reputation: 2874

Weka can not understand nominal value

I have nominal attribute to categorize my instances and I create it as follow:

line 15 : @attribute uniqID nominal

but when I try to run classification by using weka Api in java I get the following error:

Exception in thread "main" java.io.IOException: no valid attribute type or invalid enumeration, read Token[nominal], line 15

here is what I have in the header of my arrf file:

@attribute advNum numeric
@attribute isLink {0, 1}
@attribute uniqID nominal

Am I missing anything?Also if I use string instead of nominal( I just want to give a unique id to some instances for example those that has the same username) do I get the same result?

Upvotes: 0

Views: 2813

Answers (1)

user5221125
user5221125

Reputation:

arff format require possible values of a nominal field are given
as an enumeration at the header. (and nominal itself is not a keyword)

http://www.cs.waikato.ac.nz/ml/weka/arff.html

Nominal values are defined by providing an nominal-specification
listing the possible values: {nominal-name1, nominal-name2, nominal-name3, ...}

For example, the class value of the Iris dataset can be defined as follows:

@ATTRIBUTE class        {Iris-setosa,Iris-versicolor,Iris-virginica}

maybe what you need is the string type.

Upvotes: 6

Related Questions