The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Converting nominal to numeric
Legacy User
Member Posts: 0 Newbie
I am very new to RapidMinder, and I need to convert a lot of nominal attributes to numeric. I tried Nominal2Numerical in operator in RapidMiner 4.4 hoping it would do dichotomization - but it does not, instead it seems to be doing the conversion to equidistant real numbers which does not seem to make much sense, at least in my case.
Eventually, I figured out how to do dichotomization "manually" by using ConditionedFeatureGeneration, but it gets tedious since I have to create an separate operator for each value of each attribute, and there're many.
For nominals with many possible values, I figured out how to convert them to target frequencies using ValueIterator and macros, but again it seems like I might be missing a much simpler solution.
I will appreaciate any advice!
Thanks,
~Alexei
Eventually, I figured out how to do dichotomization "manually" by using ConditionedFeatureGeneration, but it gets tedious since I have to create an separate operator for each value of each attribute, and there're many.
For nominals with many possible values, I figured out how to convert them to target frequencies using ValueIterator and macros, but again it seems like I might be missing a much simpler solution.
I will appreaciate any advice!
Thanks,
~Alexei
Tagged:
0
Answers
I think you can avoid all that horrible re-typing by using variables, or as they are termed in RM "macros". Here's what I mean...
Good luck, and good weekend!
Problem is, it adds the correct attribute at each iteratation, but does not keep it around for the next iteration. No matter if "work_on_input" is true or false, at the very end of the process, I end up with the original unmodified ExampleSource.
I guess I could rename my attributes so I can apply your suggestion directly and get rid of FeatureIterator, but I am hoping that again, I may be missing something simple...
Thanks,
~Alexei
<operator name="FeatureIterator" class="FeatureIterator" expanded="yes">
<parameter key="filter" value=""/>
<parameter key="type_filter" value="nominal"/>
<parameter key="work_on_input" value="false"/>
<operator name="ValueIteratorNominalDichotomization" class="ValueIterator" expanded="yes">
<parameter key="attribute" value="%{loop_feature}"/>
<operator name="ConditionedFeatureGeneration" class="ConditionedFeatureGeneration">
<parameter key="attribute_name" value="%{loop_feature}_%{loop_value}"/>
<parameter key="value_type" value="integer"/>
<list key="values">
<parameter key="1" value="%{loop_feature}=%{loop_value}"/>
</list>
<parameter key="default_value" value="0"/>
</operator>
</operator>
Successive "joins" can be a problem unless you use the IteratingOperatorChain, which keeps the output. There is an example of this at work at http://rapid-i.com/rapidforum/index.php/topic,773.0.html.
RapidMiner surely allows to find complicate solutions. Fortunately, there are often also simple ones. Just use the [tt]Nominal2Binominal[/tt] and a subsequent [tt]Nominal2Numerical[/tt] operator and you're done with the dichotomization.
Kind regards,
Tobias
Ingo