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.
convert values
Best Answer
-
varunm1 Member Posts: 1,207 UnicornHi @bookitsa
Once you upload the data set connect "Replace" operator and select attribute filter type single and select the relevant attribute. Now you need to check include special attributes. Then in replace what give 2 and replace by yes. Then you can connect one more replace attribute after this and change 4 to no. You can find sample code below. This works for the present requirement, there might be some other methods as well.<?xml version="1.0" encoding="UTF-8"?><process version="9.1.000"> <context> <input/> <output/> <macros/> </context> <operator activated="true" class="process" compatibility="9.1.000" expanded="true" name="Process"> <parameter key="logverbosity" value="init"/> <parameter key="random_seed" value="2001"/> <parameter key="send_mail" value="never"/> <parameter key="notification_email" value=""/> <parameter key="process_duration_for_mail" value="30"/> <parameter key="encoding" value="SYSTEM"/> <process expanded="true"> <operator activated="true" class="generate_data" compatibility="9.1.000" expanded="true" height="68" name="Generate Data" width="90" x="112" y="187"> <parameter key="target_function" value="sinus classification"/> <parameter key="number_examples" value="100"/> <parameter key="number_of_attributes" value="5"/> <parameter key="attributes_lower_bound" value="-10.0"/> <parameter key="attributes_upper_bound" value="10.0"/> <parameter key="gaussian_standard_deviation" value="10.0"/> <parameter key="largest_radius" value="10.0"/> <parameter key="use_local_random_seed" value="false"/> <parameter key="local_random_seed" value="1992"/> <parameter key="datamanagement" value="double_array"/> <parameter key="data_management" value="auto"/> </operator> <operator activated="true" class="replace" compatibility="9.1.000" expanded="true" height="82" name="Replace" width="90" x="380" y="187"> <parameter key="attribute_filter_type" value="single"/> <parameter key="attribute" value="label"/> <parameter key="attributes" value=""/> <parameter key="use_except_expression" value="false"/> <parameter key="value_type" value="nominal"/> <parameter key="use_value_type_exception" value="false"/> <parameter key="except_value_type" value="file_path"/> <parameter key="block_type" value="single_value"/> <parameter key="use_block_type_exception" value="false"/> <parameter key="except_block_type" value="single_value"/> <parameter key="invert_selection" value="false"/> <parameter key="include_special_attributes" value="true"/> <parameter key="replace_what" value="positive"/> <parameter key="replace_by" value="1"/> </operator> <operator activated="true" class="replace" compatibility="9.1.000" expanded="true" height="82" name="Replace (2)" width="90" x="514" y="187"> <parameter key="attribute_filter_type" value="single"/> <parameter key="attribute" value="label"/> <parameter key="attributes" value=""/> <parameter key="use_except_expression" value="false"/> <parameter key="value_type" value="nominal"/> <parameter key="use_value_type_exception" value="false"/> <parameter key="except_value_type" value="file_path"/> <parameter key="block_type" value="single_value"/> <parameter key="use_block_type_exception" value="false"/> <parameter key="except_block_type" value="single_value"/> <parameter key="invert_selection" value="false"/> <parameter key="include_special_attributes" value="true"/> <parameter key="replace_what" value="negative"/> <parameter key="replace_by" value="0"/> </operator> <connect from_op="Generate Data" from_port="output" to_op="Replace" to_port="example set input"/> <connect from_op="Replace" from_port="example set output" to_op="Replace (2)" to_port="example set input"/> <connect from_op="Replace (2)" from_port="example set output" to_port="result 1"/> <portSpacing port="source_input 1" spacing="0"/> <portSpacing port="sink_result 1" spacing="0"/> <portSpacing port="sink_result 2" spacing="0"/> </process> </operator> </process>
Thanks,
VarunRegards,
Varun
https://www.varunmandalapu.com/Be Safe. Follow precautions and Maintain Social Distancing
7
Answers
You can also use the Generate Attribute operator. For the attribute name you choose the old attribute name (it will be overwritten with the new values. For the function expression, you use:
if ([attribute name] == 2, "yes", "no")
Of course you have to replace [attribute name] with your own attribute name (and maybe change "yes" and "no" if the 4 should be converted to a "yes"
Best regards,
Fabian
Lindon Ventures
Data Science Consulting from Certified RapidMiner Experts