FusterCluck
FusterCluck

Reputation: 503

Weka filter that edits values

Is there a filter I can apply that changes the values of a nominal attribute?

Eg I have a fruit attribute, which can have values of apple, pear, banana, orange. I want to change the possible values to tasty and horrible. I also want to change the values in my dataset, to be mapped corrrectly to these new possible categories.

Basically I want a filter that can automatically do what you can do manually via the edit window.

Upvotes: 2

Views: 1251

Answers (1)

Erol
Erol

Reputation: 6526

I am not sure if a possible solution exists in the GUI, other than changing each class value one by one or using Search and Replace function of a CSV editor program. However, you can take handle it with a simple Java code and WEKA library.

 for (int n = 0; n < att.numValues(); n++) {
    arff.renameAttributeValue(att, att.value(n), "" + n);

Here is a method that already does it.

Upvotes: 1

Related Questions