Changing binominal attribute to numeric

omohsen
omohsen New Altair Community Member
edited November 2024 in Community Q&A

Hello all,

 

I am wondering if there is any way in Rapidminer to change the type of an attribute from binominal/polynominal to a numeric value.

For example: if I have an attribue called Sex, taking two values: "Male" or "Female".

I want to change the type of this attriube to, let's say an integer value, taking 1 for "Male" and 2 for "Female".

 

** I tried using MAP operator. It changed the value; however, not the type. So, "Male" has been changed to "1" as a string, not 1 as an integer.

If all possible, how to perform such an operation in Rapidminer?

 

Thanks,

Best Answers

  • Thomas_Ott
    Thomas_Ott New Altair Community Member
    Answer ✓
    Try a Generate Attributes operator too.
  • Telcontar120
    Telcontar120 New Altair Community Member
    Answer ✓

    The operator "Nominal to Numeric" will do exactly what you are asking with the parameter option coding type set to "unique integers", but please be careful with this.  For binominals it is fine, but if you map polynominal values of different categories like colors onto numbers like {1,2,3} then you are implying something about the linear relationship and distances between those categories that may not exist in real life.

     

     

Answers

  • Thomas_Ott
    Thomas_Ott New Altair Community Member
    Answer ✓
    Try a Generate Attributes operator too.
  • Telcontar120
    Telcontar120 New Altair Community Member
    Answer ✓

    The operator "Nominal to Numeric" will do exactly what you are asking with the parameter option coding type set to "unique integers", but please be careful with this.  For binominals it is fine, but if you map polynominal values of different categories like colors onto numbers like {1,2,3} then you are implying something about the linear relationship and distances between those categories that may not exist in real life.