🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

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

User: "Malek"
New Altair Community Member
Updated by Jocelyn
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?

Find more posts tagged with

Sort by:
1 - 7 of 71
    Hi,
    i would recommend to use Generate Attributes with:
    if(Age<20,"Young",str(Age))
    or similar.

    Best,
    Martin
    User: "Malek"
    New Altair Community Member
    OP
    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 :)

    Hi,
    you can still use GenAtt and just give the new att a new name.
    BR,
    Martin
    User: "Malek"
    New Altair Community Member
    OP
    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  
    User: "BalazsBaranyRM"
    New Altair Community Member
    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
    User: "Malek"
    New Altair Community Member
    OP
    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 ==?
    User: "BalazsBaranyRM"
    New Altair Community Member
    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