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 replace specific data points

YESYES Member Posts: 1 image Learner I
Lets say we have the following data set 
Attribute: Age, Gender, Floor 
 Row 1.    11     Male      20
 Row 2     11     Female  29
 Row 3     13     Male      18
 Row 4     12     Male.     17

 How do we change only the age of row 2 from 11 to 12 without changing the age value of row 1 from 11 to 12? Thank You

Answers

  • ClaudioKeckClaudioKeck Employee-RapidMiner, Member Posts: 38 image Guru
    edited January 2024
    Hi, 

    see this exmaple workflow below how this could be done. you could either use the "Map" (Numerical) or "Replace" (Nominal) Operator or the Data Editor. 

    <?xml version="1.0" encoding="UTF-8"?><process version="10.3.001">
    
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="10.3.001" 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="10.3.001" expanded="true" height="68" name="Create ExampleSet" width="90" x="179" y="136">
    <parameter key="generator_type" value="comma separated text"/>
    <parameter key="number_of_examples" value="100"/>
    <parameter key="use_stepsize" value="false"/>
    <list key="function_descriptions"/>
    <parameter key="add_id_attribute" value="false"/>
    <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="input_csv_text" value="Age,GEnder,Floor&#10;11,Male,20&#10;11,Female,29&#10;13,Male,18&#10;12,Male,17"/>
    <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="blending:generate_id" compatibility="10.3.001" expanded="true" height="82" name="Generate ID" width="90" x="313" y="136">
    <parameter key="create_nominal_ids" value="false"/>
    <parameter key="offset" value="0"/>
    </operator>
    <operator activated="true" class="filter_examples" compatibility="10.3.001" expanded="true" height="103" name="Filter Examples" width="90" x="447" y="187">
    <parameter key="parameter_expression" value=""/>
    <parameter key="condition_class" value="custom_filters"/>
    <parameter key="invert_filter" value="false"/>
    <list key="filters_list">
    <parameter key="filters_entry_key" value="id.eq.2"/>
    </list>
    <parameter key="filters_logic_and" value="true"/>
    <parameter key="filters_check_metadata" value="true"/>
    </operator>
    <operator activated="true" class="map" compatibility="10.3.001" expanded="true" height="82" name="Map" width="90" x="581" y="136">
    <parameter key="attribute_filter_type" value="single"/>
    <parameter key="attribute" value="Age"/>
    <parameter key="attributes" value=""/>
    <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"/>
    <list key="value_mappings"/>
    <parameter key="replace_what" value="11"/>
    <parameter key="replace_by" value="12"/>
    <parameter key="consider_regular_expressions" value="false"/>
    <parameter key="add_default_mapping" value="false"/>
    </operator>
    <operator activated="true" class="append" compatibility="10.3.001" expanded="true" height="103" name="Append" width="90" x="715" y="136">
    <parameter key="datamanagement" value="double_array"/>
    <parameter key="data_management" value="auto"/>
    <parameter key="merge_type" value="all"/>
    </operator>
    <operator activated="true" class="blending:sort" compatibility="10.3.001" expanded="true" height="82" name="Sort" width="90" x="849" y="136">
    <list key="sort_by">
    <parameter key="id" value="ascending"/>
    </list>
    </operator>
    <connect from_op="Create ExampleSet" from_port="output" to_op="Generate ID" to_port="example set input"/>
    <connect from_op="Generate ID" from_port="example set output" to_op="Filter Examples" to_port="example set input"/>
    <connect from_op="Filter Examples" from_port="example set output" to_op="Map" to_port="example set input"/>
    <connect from_op="Filter Examples" from_port="unmatched example set" to_op="Append" to_port="example set 2"/>
    <connect from_op="Map" from_port="example set output" to_op="Append" to_port="example set 1"/>
    <connect from_op="Append" from_port="merged set" 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>
  • MartinLiebigMartinLiebig Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,533 image RM Data Scientist
    edited January 2024
    Another option can be the Set Data operator, which sets the value of an individual cell.

    BR,
    Martin
    - Sr. Director Data Solutions, Altair RapidMiner -
    Dortmund, Germany
Sign In or Register to comment.