Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.
Map operator -entering multiple old values on one line in the value mapping parameter
Hi,
I need to map a large range old of values to one new value. For example I need to change instances values 1,2,3,4,5,6.... to the value Red.
Is it possible to enter them all on the one line in the value mappings parameter and what is the syntax. Or do i need to add a new line for each old attribute?
Thanks,
J.
0
Answers
You could use the Generate Attributes operator and do something like this:
If(attribute < 10, "Red", "Not Red")
Hi T-Bone,
Thanks for the response.
The old values that I want to replace are nominal attributes, and they range from 1 to 999 and there are also some alpha numeric codes as well such as V1 to V10 and E1 to E10.
So for example 1 to 20, and 25 and V1 might correspond to Red, 30 to 35, and V2 might correspond to Green, 50 to 100, and 125 and E1 might correspond to Yellow etc.
The Map operator works for what I want to do, but I don't want to have to enter a separate line for each individual code as it would be too time consuming. Is it possible to enter a range of old values on one line of the value mapping parameter that maps to one new value?
I think the problem with using Generate Attributes is if I replace the code 8 with Red, it will replace the 8 in 18, 28, 38, 48 etc with Red was well.
Thanks,
J.
@B00093053 You may also be interested in checking out the "Replace (Dictionary)" operator, which allows you to create a separate input txt file of all the replacements you want to make and to do it that way---you can use Excel or something similar to generate the input values quickly. If I have a large volume of substitutions to do I find it easier than using "Map" and doing all the data entry in RapidMiner by hand.
The other option would be to use "Parse Numbers" first and then do the "Generate Attributes" using the GT/LT logic. But you may need to copy the original attribute into multiple attributes first if it contains both numbers and characters.
Lindon Ventures
Data Science Consulting from Certified RapidMiner Experts
Hi @B00093053 ,
Yes you can. May I introduce you to regular expressions.
They are pretty powerful and will allow you to do what you need, you just need to find the right one for each replacement.
Here's a wee example using RegEx in both the Generate Attributes & Mapping operators.