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
How to compare 2 examples using loop in Execute Script operator?
I want to compare 2 examples in one attribute named "ID" and if they are equal then I have to compare another set of examples under another attribute named "Date". If they match, then I need to rank them with same rank starting from 1 in ascending order. If the examples do not match in "Date" attribute then I need to rank them as 1,2 & so on. How to achieve this using Execute Script operator? Please help.
Tagged:
0
Answers
Lindon Ventures
Data Science Consulting from Certified RapidMiner Experts
Dortmund, Germany
I couldn't find the attached process. There's only 1 line in the attachment. Can you please attach it again. Thank you.
<context>
<input/>
<output/>
<macros/>
</context>
<operator activated="true" class="process" compatibility="9.7.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="utility:create_exampleset" compatibility="9.7.000" expanded="true" height="68" name="Create ExampleSet" width="90" x="45" y="85">
<parameter key="generator_type" value="attribute functions"/>
<parameter key="number_of_examples" value="100"/>
<parameter key="use_stepsize" value="false"/>
<list key="function_descriptions">
<parameter key="date" value="date_add(date_now(),round(rand())*50,DATE_UNIT_DAY)"/>
<parameter key="Generated ID" value="id%10"/>
<parameter key="random" value="rand()"/>
</list>
<parameter key="add_id_attribute" value="true"/>
<list key="numeric_series_configuration"/>
<list key="date_series_configuration"/>
<list key="date_series_configuration (interval)"/>
<parameter key="date_format" value="yyyy-MM-dd HH:mm:ss"/>
<parameter key="time_zone" value="SYSTEM"/>
<parameter key="column_separator" value=","/>
<parameter key="parse_all_as_nominal" value="false"/>
<parameter key="decimal_point_character" value="."/>
<parameter key="trim_attribute_names" value="true"/>
</operator>
<operator activated="true" class="remove_duplicates" compatibility="9.7.000" expanded="true" height="103" name="Remove Duplicates" width="90" x="179" y="85">
<parameter key="attribute_filter_type" value="subset"/>
<parameter key="attribute" value=""/>
<parameter key="attributes" value="Generated ID|date"/>
<parameter key="use_except_expression" value="false"/>
<parameter key="value_type" value="attribute_value"/>
<parameter key="use_value_type_exception" value="false"/>
<parameter key="except_value_type" value="time"/>
<parameter key="block_type" value="attribute_block"/>
<parameter key="use_block_type_exception" value="false"/>
<parameter key="except_block_type" value="value_matrix_row_start"/>
<parameter key="invert_selection" value="false"/>
<parameter key="include_special_attributes" value="false"/>
<parameter key="treat_missing_values_as_duplicates" value="false"/>
</operator>
<operator activated="true" class="concurrency:join" compatibility="9.7.000" expanded="true" height="82" name="Join" width="90" x="380" y="85">
<parameter key="remove_double_attributes" value="true"/>
<parameter key="join_type" value="inner"/>
<parameter key="use_id_attribute_as_key" value="false"/>
<list key="key_attributes">
<parameter key="Generated ID" value="Generated ID"/>
<parameter key="date" value="date"/>
</list>
<parameter key="keep_both_join_attributes" value="false"/>
</operator>
<operator activated="true" class="sort" compatibility="9.7.000" expanded="true" height="82" name="Sort" width="90" x="514" y="85">
<parameter key="attribute_name" value="random"/>
<parameter key="sorting_direction" value="decreasing"/>
</operator>
<connect from_op="Create ExampleSet" from_port="output" to_op="Remove Duplicates" to_port="example set input"/>
<connect from_op="Remove Duplicates" from_port="example set output" to_op="Join" to_port="left"/>
<connect from_op="Remove Duplicates" from_port="duplicates" to_op="Join" to_port="right"/>
<connect from_op="Join" from_port="join" to_op="Sort" to_port="example set input"/>
<connect from_op="Sort" 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>
Dortmund, Germany