Rename+Attribute+Values

toc After discretizing an attribute you might want to rename the values of the newly created nominal attribute. E.g., after discretizing a numeric attribute with values ranging from 1 to 100 you might end up with a nominal attribute that has the following values: code format="text" '1-15','16-18','29-100' code You can use the method of the  class (see [|API]) to rename this values into, e.g., 0, 1 and 2. Here's a code snippet how to do this ( is an Instances object, is an attribute of the same instances object): code format="java" for (int n = 0; n < att.numValues; n++) { arff.renameAttributeValue(att, att.value(n), "" + n); code The class takes an ARFF file and transforms all attributes (or just the specified one) like mentioned above.

= See also =
 * Use Weka in your Java code

= Downloads =
 * [[file:Rename.java]] ([|book], [|stable-3.6], [|developer])