!Urgent! How to use map operator to map a numerical value in range to a string??
Malek
New Altair Community Member
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?
replace what: < 20
replace by: young
Any body can help please?
Tagged:
0
Answers
-
Hi,i would recommend to use Generate Attributes with:if(Age<20,"Young",str(Age))or similar.Best,Martin2
-
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
0 -
Hi,you can still use GenAtt and just give the new att a new name.BR,Martin0
-
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 you0 -
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ázs1 -
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 ==?0 -
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ázs1