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

Macro

Reem11Reem11 Member Posts: 4 Contributor I
I want create process like this 
1- I have the column with T/F value 
2- I need to create a new column as counter if the last column has T value start the counter if the value is change make value 0 and restart the counter value as 0
Tagged:

Best Answers

  • ClaudioKeckClaudioKeck Employee-RapidMiner, Member Posts: 38 Guru
    Solution Accepted
    Hi @Reem11

    this should do the job: 

    <?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="45" y="85">
    <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="T/F&#10;T,&#10;T,&#10;T,&#10;F,&#10;F,&#10;F,&#10;F,&#10;F,&#10;T,&#10;F,&#10;F,&#10;F&#10;"/>
    <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="time_series:lag_series_with_default_lag" compatibility="10.3.001" expanded="true" height="82" name="Lag" width="90" x="179" y="85">
    <list key="individual_lags">
    <parameter key="T/F" value="1"/>
    </list>
    <parameter key="add_default_lag" value="false"/>
    <parameter key="attribute_filter_type" value="all"/>
    <parameter key="attribute" value=""/>
    <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"/>
    <parameter key="default_lag" value="1"/>
    <parameter key="overwrite_attributes" value="false"/>
    <parameter key="extend_exampleset" value="true"/>
    </operator>
    <operator activated="true" class="time_series:replace_missing_values" compatibility="10.3.001" expanded="true" height="68" name="Replace Missing Values (Series)" width="90" x="313" y="85">
    <parameter key="attribute_filter_type" value="single"/>
    <parameter key="attribute" value="T/F-1"/>
    <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"/>
    <parameter key="has_indices" value="false"/>
    <parameter key="indices_attribute" value=""/>
    <parameter key="sort_time_series" value="false"/>
    <parameter key="overwrite_attributes" value="true"/>
    <parameter key="new_attributes_postfix" value="_cleaned"/>
    <parameter key="replace_type_numerical" value="previous value"/>
    <parameter key="replace_type_nominal" value="previous value"/>
    <parameter key="replace_type_date_time" value="previous value"/>
    <parameter key="replace_value_numerical" value="0.0"/>
    <parameter key="replace_value_nominal" value="unknown"/>
    <parameter key="skip_other_missings" value="true"/>
    <parameter key="replace_infinity" value="true"/>
    <parameter key="replace_empty_strings" value="true"/>
    <parameter key="ensure_finite_values" value="false"/>
    </operator>
    <operator activated="true" class="blending:generate_id" compatibility="10.3.001" expanded="true" height="82" name="Generate ID" width="90" x="447" y="85">
    <parameter key="create_nominal_ids" value="false"/>
    <parameter key="offset" value="0"/>
    </operator>
    <operator activated="true" class="blending:set_role" compatibility="10.3.001" expanded="true" height="82" name="Set Role" width="90" x="581" y="85">
    <list key="set_roles">
    <parameter key="id" value="regular"/>
    </list>
    </operator>
    <operator activated="true" class="blending:generate_columns" compatibility="10.3.001" expanded="true" height="82" name="Generate Attributes (2)" width="90" x="715" y="85">
    <list key="function_descriptions">
    <parameter key="Counter" value="if([T/F]==[T/F-1],&quot;xy&quot;,str(id))"/>
    </list>
    <parameter key="keep_all_columns" value="true"/>
    </operator>
    <operator activated="true" class="replace" compatibility="10.3.001" expanded="true" height="82" name="Replace" width="90" x="849" y="85">
    <parameter key="attribute_filter_type" value="single"/>
    <parameter key="attribute" value="Counter"/>
    <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="false"/>
    <parameter key="replace_what" value="xy"/>
    </operator>
    <operator activated="true" class="time_series:replace_missing_values" compatibility="10.3.001" expanded="true" height="68" name="Replace Missing Values (Series) (2)" width="90" x="983" y="85">
    <parameter key="attribute_filter_type" value="single"/>
    <parameter key="attribute" value="Counter"/>
    <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"/>
    <parameter key="has_indices" value="false"/>
    <parameter key="indices_attribute" value=""/>
    <parameter key="sort_time_series" value="false"/>
    <parameter key="overwrite_attributes" value="true"/>
    <parameter key="new_attributes_postfix" value="_cleaned"/>
    <parameter key="replace_type_numerical" value="previous value"/>
    <parameter key="replace_type_nominal" value="previous value"/>
    <parameter key="replace_type_date_time" value="previous value"/>
    <parameter key="replace_value_numerical" value="0.0"/>
    <parameter key="replace_value_nominal" value="unknown"/>
    <parameter key="skip_other_missings" value="true"/>
    <parameter key="replace_infinity" value="true"/>
    <parameter key="replace_empty_strings" value="true"/>
    <parameter key="ensure_finite_values" value="false"/>
    </operator>
    <operator activated="true" class="numerical_to_polynominal" compatibility="10.3.001" expanded="true" height="82" name="Numerical to Polynominal" width="90" x="1117" y="85">
    <parameter key="attribute_filter_type" value="single"/>
    <parameter key="attribute" value="id"/>
    <parameter key="attributes" value=""/>
    <parameter key="use_except_expression" value="false"/>
    <parameter key="value_type" value="numeric"/>
    <parameter key="use_value_type_exception" value="false"/>
    <parameter key="except_value_type" value="real"/>
    <parameter key="block_type" value="value_series"/>
    <parameter key="use_block_type_exception" value="false"/>
    <parameter key="except_block_type" value="value_series_end"/>
    <parameter key="invert_selection" value="false"/>
    <parameter key="include_special_attributes" value="false"/>
    </operator>
    <operator activated="true" class="concurrency:loop_values" compatibility="10.3.001" expanded="true" height="82" name="Loop Values" width="90" x="1251" y="85">
    <parameter key="attribute" value="id"/>
    <parameter key="iteration_macro" value="loop_value"/>
    <parameter key="reuse_results" value="false"/>
    <parameter key="enable_parallel_execution" value="true"/>
    <process expanded="true">
    <operator activated="true" class="filter_examples" compatibility="10.3.001" expanded="true" height="103" name="Filter Examples" width="90" x="179" y="34">
    <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="Counter.equals.%{loop_value}"/>
    </list>
    <parameter key="filters_logic_and" value="true"/>
    <parameter key="filters_check_metadata" value="true"/>
    </operator>
    <operator activated="true" class="blending:generate_id" compatibility="10.3.001" expanded="true" height="82" name="Generate ID (2)" width="90" x="313" y="34">
    <parameter key="create_nominal_ids" value="false"/>
    <parameter key="offset" value="-1"/>
    </operator>
    <operator activated="true" class="blending:set_role" compatibility="10.3.001" expanded="true" height="82" name="Set Role (2)" width="90" x="447" y="34">
    <list key="set_roles">
    <parameter key="id" value="regular"/>
    </list>
    </operator>
    <operator activated="true" class="blending:select_attributes" compatibility="10.3.001" expanded="true" height="82" name="Select Attributes" width="90" x="581" y="34">
    <parameter key="type" value="include attributes"/>
    <parameter key="attribute_filter_type" value="a subset"/>
    <parameter key="select_attribute" value=""/>
    <parameter key="select_subset" value="id␞T/F␞Counter"/>
    <parameter key="also_apply_to_special_attributes_(id,_label..)" value="false"/>
    </operator>
    <operator activated="true" class="filter_examples" compatibility="10.3.001" expanded="true" height="103" name="Filter Examples (2)" width="90" x="715" y="34">
    <parameter key="parameter_expression" value=""/>
    <parameter key="condition_class" value="no_missing_attributes"/>
    <parameter key="invert_filter" value="false"/>
    <list key="filters_list"/>
    <parameter key="filters_logic_and" value="true"/>
    <parameter key="filters_check_metadata" value="true"/>
    </operator>
    <connect from_port="input 1" to_op="Filter Examples" to_port="example set input"/>
    <connect from_op="Filter Examples" from_port="example set output" to_op="Generate ID (2)" to_port="example set input"/>
    <connect from_op="Generate ID (2)" from_port="example set output" to_op="Set Role (2)" to_port="example set input"/>
    <connect from_op="Set Role (2)" from_port="example set output" to_op="Select Attributes" to_port="example set input"/>
    <connect from_op="Select Attributes" from_port="example set output" to_op="Filter Examples (2)" to_port="example set input"/>
    <connect from_op="Filter Examples (2)" from_port="example set output" to_port="output 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="source_input 2" spacing="0"/>
    <portSpacing port="sink_output 1" spacing="0"/>
    <portSpacing port="sink_output 2" spacing="0"/>
    </process>
    </operator>
    <operator activated="true" class="operator_toolbox:advanced_append" compatibility="2.17.000" expanded="true" height="82" name="Append (Superset)" width="90" x="1385" y="85"/>
    <connect from_op="Create ExampleSet" from_port="output" to_op="Lag" to_port="example set input"/>
    <connect from_op="Lag" from_port="example set output" to_op="Replace Missing Values (Series)" to_port="example set"/>
    <connect from_op="Replace Missing Values (Series)" from_port="example set" to_op="Generate ID" to_port="example set input"/>
    <connect from_op="Generate ID" from_port="example set output" to_op="Set Role" to_port="example set input"/>
    <connect from_op="Set Role" from_port="example set output" to_op="Generate Attributes (2)" to_port="table input"/>
    <connect from_op="Generate Attributes (2)" from_port="table output" to_op="Replace" to_port="example set input"/>
    <connect from_op="Replace" from_port="example set output" to_op="Replace Missing Values (Series) (2)" to_port="example set"/>
    <connect from_op="Replace Missing Values (Series) (2)" from_port="example set" to_op="Numerical to Polynominal" to_port="example set input"/>
    <connect from_op="Numerical to Polynominal" from_port="example set output" to_op="Loop Values" to_port="input 1"/>
    <connect from_op="Loop Values" from_port="output 1" to_op="Append (Superset)" to_port="example set 1"/>
    <connect from_op="Append (Superset)" from_port="merged set" 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>
  • ClaudioKeckClaudioKeck Employee-RapidMiner, Member Posts: 38 Guru
    edited March 18 Solution Accepted
    which RM version do you use? If you use an older verison than 10.x you might need to upgrade RM or replace the operators with the "older" verisons of them

Answers

  • Reem11Reem11 Member Posts: 4 Contributor I
    I have this message in Generate ID and Generate Attributes operater :
    " No compatible version of the  selected extension could be found"
    how can i solve it 

  • Reem11Reem11 Member Posts: 4 Contributor I
    edited March 18
    okay thank you :smile:

Sign In or Register to comment.