generate attribute based on multiple values

khansaa0000
khansaa0000 New Altair Community Member
edited November 2024 in Community Q&A

 hi every body i am new in using rapidmier i wish i will find help here

i have 12 attributes which are representing the number of transaction per each month of the year i want to compere this value in order to show the curve is it increasing or decreasing

Welcome!

It looks like you're new here. Sign in or register to get started.

Best Answer

  • sgenzer
    sgenzer
    Altair Employee
    Answer ✓

    ok hello again @khansaa0000 - I think this will help.  But before you use this, please upgrade to RapidMiner 8.

     

    <?xml version="1.0" encoding="UTF-8"?><process version="8.0.001">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="8.0.001" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="read_csv" compatibility="8.0.001" expanded="true" height="68" name="Read CSV" width="90" x="45" y="34">
    <parameter key="csv_file" value="/Users/genzerconsulting/Desktop/month_transaction - Copy.csv"/>
    <parameter key="column_separators" value=","/>
    <parameter key="first_row_as_names" value="false"/>
    <list key="annotations">
    <parameter key="0" value="Name"/>
    </list>
    <parameter key="time_zone" value="SYSTEM"/>
    <parameter key="encoding" value="windows-1252"/>
    <list key="data_set_meta_data_information">
    <parameter key="0" value="cus_id.true.polynominal.attribute"/>
    <parameter key="1" value="num_of_tran_jan.true.integer.attribute"/>
    <parameter key="2" value="num_of_feb.true.integer.attribute"/>
    <parameter key="3" value="num_of_tran_mar.true.integer.attribute"/>
    <parameter key="4" value="num_of_tran_apr.true.integer.attribute"/>
    <parameter key="5" value="num_of_tran_may.true.integer.attribute"/>
    <parameter key="6" value="num_of_tran_jun.true.integer.attribute"/>
    <parameter key="7" value="num_of_tran_jul.true.integer.attribute"/>
    <parameter key="8" value="num_of_tran_aug.true.integer.attribute"/>
    <parameter key="9" value="num_of_tran_sep.true.integer.attribute"/>
    <parameter key="10" value="num_of_tran_oct.true.integer.attribute"/>
    <parameter key="11" value="num_of_tran_no.true.integer.attribute"/>
    <parameter key="12" value="num_of_tran_dec.true.integer.attribute"/>
    </list>
    </operator>
    <operator activated="true" class="nominal_to_numerical" compatibility="8.0.001" expanded="true" height="103" name="Nominal to Numerical" width="90" x="179" y="34">
    <parameter key="attribute_filter_type" value="subset"/>
    <parameter key="attributes" value="acc_type|activity|stu"/>
    <parameter key="coding_type" value="unique integers"/>
    <list key="comparison_groups"/>
    </operator>
    <operator activated="true" class="select_attributes" compatibility="8.0.001" expanded="true" height="82" name="Select Attributes" width="90" x="313" y="85">
    <parameter key="attribute_filter_type" value="subset"/>
    <parameter key="attributes" value="cust_id||sum_in_money|sum_of_out_money|num_of_tran_jun|num_of_tran_mar|num_of_tran_dec|num_of_tran_apr|cus_id|num_of_feb|num_of_tran_sep|num_of_tran_oct|num_of_tran_no|num_of_tran_may|num_of_tran_jul|num_of_tran_jan|num_of_tran_aug"/>
    </operator>
    <operator activated="true" class="generate_attributes" compatibility="8.0.001" expanded="true" height="82" name="Generate Attributes" width="90" x="447" y="85">
    <list key="function_descriptions">
    <parameter key="Curve" value="if(num_of_tran_jul&gt;num_of_feb,&quot;Curve Decreases&quot;,&#10;if(num_of_tran_jul&lt;num_of_feb,&quot;Curve Increases&quot;,&quot;No change&quot;))"/>
    </list>
    </operator>
    <connect from_op="Read CSV" from_port="output" to_op="Nominal to Numerical" to_port="example set input"/>
    <connect from_op="Nominal to Numerical" 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="Generate Attributes" to_port="example set input"/>
    <connect from_op="Generate Attributes" 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>

    Scott

Answers

  • sgenzer
    sgenzer
    Altair Employee

    hello @khansaa0000 - very good to see you here. :)  Please reply with your data set attached (click the "Choose Files" button) and insert any XML process you have built so far using the </> code insert tool.

     

    Scott

     

     

  • Thomas_Ott
    Thomas_Ott New Altair Community Member

    So this is pretty easy to visualize assuming your data is in this format:

     

    Month  Sales

    Jan      10000

    Feb      9000

    Mar      9500

     

    You can just go to the Charts tab and select the right line chart.

  • khansaa0000
    khansaa0000 New Altair Community Member

    no i have data about 800 customer this number of transaction per month like

    cust_id ,  number of transaction of January ,number of transaction of feb , .... til dec

  • khansaa0000
    khansaa0000 New Altair Community Member

     ok this my code

    <?xml version="1.0" encoding="UTF-8"?><process version="7.5.001">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="7.5.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="read_csv" compatibility="7.5.001" expanded="true" height="68" name="Read CSV" width="90" x="45" y="34">
            <parameter key="csv_file" value="C:\Users\Khansaa\Desktop\month_transaction.csv"/>
            <parameter key="column_separators" value=","/>
            <parameter key="trim_lines" value="false"/>
            <parameter key="use_quotes" value="true"/>
            <parameter key="quotes_character" value="&quot;"/>
            <parameter key="escape_character" value="\"/>
            <parameter key="skip_comments" value="false"/>
            <parameter key="comment_characters" value="#"/>
            <parameter key="parse_numbers" value="true"/>
            <parameter key="decimal_character" value="."/>
            <parameter key="grouped_digits" value="false"/>
            <parameter key="grouping_character" value=","/>
            <parameter key="date_format" value=""/>
            <parameter key="first_row_as_names" value="false"/>
            <list key="annotations">
              <parameter key="0" value="Name"/>
            </list>
            <parameter key="time_zone" value="SYSTEM"/>
            <parameter key="locale" value="English (United States)"/>
            <parameter key="encoding" value="windows-1252"/>
            <list key="data_set_meta_data_information">
              <parameter key="0" value="cus_id.true.integer.attribute"/>
              <parameter key="1" value="num_of_tran_jan.true.integer.attribute"/>
              <parameter key="2" value="num_of_feb.true.integer.attribute"/>
              <parameter key="3" value="num_of_tran_mar.true.integer.attribute"/>
              <parameter key="4" value="num_of_tran_apr.true.integer.attribute"/>
              <parameter key="5" value="num_of_tran_may.true.integer.attribute"/>
              <parameter key="6" value="num_of_tran_jun.true.integer.attribute"/>
              <parameter key="7" value="num_of_tran_jul.true.integer.attribute"/>
              <parameter key="8" value="num_of_tran_aug.true.integer.attribute"/>
              <parameter key="9" value="num_of_tran_sep.true.integer.attribute"/>
              <parameter key="10" value="num_of_tran_oct.true.integer.attribute"/>
              <parameter key="11" value="num_of_tran_no.true.integer.attribute"/>
              <parameter key="12" value="num_of_tran_dec.true.integer.attribute"/>
            </list>
            <parameter key="read_not_matching_values_as_missings" value="true"/>
            <parameter key="datamanagement" value="double_array"/>
            <parameter key="data_management" value="auto"/>
          </operator>
          <operator activated="true" class="nominal_to_numerical" compatibility="7.5.001" expanded="true" height="103" name="Nominal to Numerical" width="90" x="179" y="34">
            <parameter key="return_preprocessing_model" value="false"/>
            <parameter key="create_view" value="false"/>
            <parameter key="attribute_filter_type" value="subset"/>
            <parameter key="attribute" value=""/>
            <parameter key="attributes" value="acc_type|activity|stu"/>
            <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="coding_type" value="unique integers"/>
            <parameter key="use_comparison_groups" value="false"/>
            <list key="comparison_groups"/>
            <parameter key="unexpected_value_handling" value="all 0 and warning"/>
            <parameter key="use_underscore_in_name" value="false"/>
          </operator>
          <operator activated="true" class="select_attributes" compatibility="7.5.001" expanded="true" height="82" name="Select Attributes" width="90" x="313" y="85">
            <parameter key="attribute_filter_type" value="subset"/>
            <parameter key="attribute" value=""/>
            <parameter key="attributes" value="cust_id||sum_in_money|sum_of_out_money|num_of_tran_jun|num_of_tran_mar|num_of_tran_dec|num_of_tran_apr|cus_id|num_of_feb|num_of_tran_sep|num_of_tran_oct|num_of_tran_no|num_of_tran_may|num_of_tran_jul|num_of_tran_jan|num_of_tran_aug"/>
            <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"/>
          </operator>
          <operator activated="true" class="generate_attributes" compatibility="7.5.001" expanded="true" height="82" name="Generate Attributes" width="90" x="447" y="85">
            <list key="function_descriptions">
              <parameter key="Curve" value="if(num_of_tran_jul&gt;num_of_feb,&quot;Curve&quot;,&quot;Decreases&quot;)&#10;if(num_of_tran_jul&lt;num_of_feb,&quot;Curve&quot;,&quot;Increases&quot;)"/>
            </list>
            <parameter key="keep_all" value="true"/>
          </operator>
          <connect from_op="Read CSV" from_port="output" to_op="Nominal to Numerical" to_port="example set input"/>
          <connect from_op="Nominal to Numerical" 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="Generate Attributes" to_port="example set input"/>
          <connect from_op="Generate Attributes" 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>

  • sgenzer
    sgenzer
    Altair Employee
    Answer ✓

    ok hello again @khansaa0000 - I think this will help.  But before you use this, please upgrade to RapidMiner 8.

     

    <?xml version="1.0" encoding="UTF-8"?><process version="8.0.001">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="8.0.001" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="read_csv" compatibility="8.0.001" expanded="true" height="68" name="Read CSV" width="90" x="45" y="34">
    <parameter key="csv_file" value="/Users/genzerconsulting/Desktop/month_transaction - Copy.csv"/>
    <parameter key="column_separators" value=","/>
    <parameter key="first_row_as_names" value="false"/>
    <list key="annotations">
    <parameter key="0" value="Name"/>
    </list>
    <parameter key="time_zone" value="SYSTEM"/>
    <parameter key="encoding" value="windows-1252"/>
    <list key="data_set_meta_data_information">
    <parameter key="0" value="cus_id.true.polynominal.attribute"/>
    <parameter key="1" value="num_of_tran_jan.true.integer.attribute"/>
    <parameter key="2" value="num_of_feb.true.integer.attribute"/>
    <parameter key="3" value="num_of_tran_mar.true.integer.attribute"/>
    <parameter key="4" value="num_of_tran_apr.true.integer.attribute"/>
    <parameter key="5" value="num_of_tran_may.true.integer.attribute"/>
    <parameter key="6" value="num_of_tran_jun.true.integer.attribute"/>
    <parameter key="7" value="num_of_tran_jul.true.integer.attribute"/>
    <parameter key="8" value="num_of_tran_aug.true.integer.attribute"/>
    <parameter key="9" value="num_of_tran_sep.true.integer.attribute"/>
    <parameter key="10" value="num_of_tran_oct.true.integer.attribute"/>
    <parameter key="11" value="num_of_tran_no.true.integer.attribute"/>
    <parameter key="12" value="num_of_tran_dec.true.integer.attribute"/>
    </list>
    </operator>
    <operator activated="true" class="nominal_to_numerical" compatibility="8.0.001" expanded="true" height="103" name="Nominal to Numerical" width="90" x="179" y="34">
    <parameter key="attribute_filter_type" value="subset"/>
    <parameter key="attributes" value="acc_type|activity|stu"/>
    <parameter key="coding_type" value="unique integers"/>
    <list key="comparison_groups"/>
    </operator>
    <operator activated="true" class="select_attributes" compatibility="8.0.001" expanded="true" height="82" name="Select Attributes" width="90" x="313" y="85">
    <parameter key="attribute_filter_type" value="subset"/>
    <parameter key="attributes" value="cust_id||sum_in_money|sum_of_out_money|num_of_tran_jun|num_of_tran_mar|num_of_tran_dec|num_of_tran_apr|cus_id|num_of_feb|num_of_tran_sep|num_of_tran_oct|num_of_tran_no|num_of_tran_may|num_of_tran_jul|num_of_tran_jan|num_of_tran_aug"/>
    </operator>
    <operator activated="true" class="generate_attributes" compatibility="8.0.001" expanded="true" height="82" name="Generate Attributes" width="90" x="447" y="85">
    <list key="function_descriptions">
    <parameter key="Curve" value="if(num_of_tran_jul&gt;num_of_feb,&quot;Curve Decreases&quot;,&#10;if(num_of_tran_jul&lt;num_of_feb,&quot;Curve Increases&quot;,&quot;No change&quot;))"/>
    </list>
    </operator>
    <connect from_op="Read CSV" from_port="output" to_op="Nominal to Numerical" to_port="example set input"/>
    <connect from_op="Nominal to Numerical" 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="Generate Attributes" to_port="example set input"/>
    <connect from_op="Generate Attributes" 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>

    Scott

  • khansaa0000
    khansaa0000 New Altair Community Member

    thank you very much

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.