!Urgent! How to use map operator to map a numerical value in range to a string??

MalekMalek Member Posts: 4 Newbie
I'm using Titanic dataset, i want to map the ages value < 20 to be "Young", it doesn't work when i add map operator and choose this values:
replace what: < 20
replace by: young
Any body can help please?

Answers

  • mschmitzmschmitz Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 2,049  RM Data Scientist
    Hi,
    i would recommend to use Generate Attributes with:
    if(Age<20,"Young",str(Age))
    or similar.

    Best,
    Martin
    - Head of Data Science Services at RapidMiner -
    Dortmund, Germany
    Maleksgenzer
  • MalekMalek Member Posts: 4 Newbie
    Hi,
    Thanks for you reply,

    I have to work on the same attribute later because its the label and to add a decision tree also..
    Why we can't use Map operator to do the following:
    < 20
    Young
    > 20 
    Old

    do you have any idea please?
    Thank you :)

  • mschmitzmschmitz Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 2,049  RM Data Scientist
    Hi,
    you can still use GenAtt and just give the new att a new name.
    BR,
    Martin
    - Head of Data Science Services at RapidMiner -
    Dortmund, Germany
  • MalekMalek Member Posts: 4 Newbie
    Hi,

    I did GenAttr and gave it a name but the resulting decision tree then is not accurate!

    I'm trying to use the Map operator for mapping the old value of the domain of integer to some words like young or old..

    have you any idea about this method please?

    Thank you  
  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 270   Unicorn
    Hi,

    don't use the Map operator for this, it is simply not meant for it. Map is used for changing nominal values in existing nominal attributes. Age is not a nominal attribute, so Map is not appropriate for it.

    Martin's Generate Attributes solution is what you need if you want to define age ranges. 

    Or you could use Discretize by User Specification:


    Regards,
    Balázs
    mschmitzTelcontar120
  • MalekMalek Member Posts: 4 Newbie
    Hi Balázs,

    Thank you for reply, but in this case the age between 20 and 40 which value will take? can you tell me this value for example?
    age 25, age 30, age 35 ==?
  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 270   Unicorn
    Hi,

    this operator works by defining the upper boundary for the classes.
    Leave the default "first: -Infinity" and "last: Infinity" as they are and then add your classes. 
    The example is set up like this:
    0 - 20: young
    > 20 - 40: middle
    > 40 - 100: old

    You can define your own boundaries. Read the help and look at the example process if necessary.

    Regards,
    Balázs
    sgenzer
Sign In or Register to comment.