RapidMiner

Highlighted
Contributor II stfn
Contributor II

Association Rules Renaming results

 

 

 

Hello. 

 

I am working on association rules. I want rules about courses every semester. It works fine but the thing is that i want to rename the results.

 

Capture.JPGFor example "321-8354" corresponds to course "Networks",  "321-8952" to "E-Management" etc...

 

 

 

 

 

 

Here is my code which does not work for "renaming" the results.

 

<?xml version="1.0" encoding="UTF-8"?><process version="7.4.000">
  <context>
    <input/>
    <output/>
    <macros/>
  </context>
  <operator activated="true" class="process" compatibility="7.4.000" expanded="true" name="Process">
    <process expanded="true">
      <operator activated="true" class="jdbc_connectors:read_database" compatibility="7.4.000" expanded="true" height="68" name="Read Database" width="90" x="45" y="34">
        <parameter key="connection" value="New connection1"/>
        <parameter key="query" value="SELECT `lesson_id` AS Item, `status` AS Amount, `student_id` AS Id&#10;FROM `grades`&#10;WHERE `edate` BETWEEN '2016-01-15' AND '2016-02-28'"/>
        <enumeration key="parameters"/>
      </operator>
      <operator activated="true" class="replace" compatibility="7.4.000" expanded="true" height="82" name="Replace (1)" width="90" x="45" y="136">
        <parameter key="attribute_filter_type" value="single"/>
        <parameter key="attribute" value="Amount"/>
        <parameter key="replace_what" value="Success"/>
        <parameter key="replace_by" value="1"/>
      </operator>
      <operator activated="true" class="replace" compatibility="7.4.000" expanded="true" height="82" name="Replace (3)" width="90" x="45" y="238">
        <parameter key="attribute_filter_type" value="single"/>
        <parameter key="attribute" value="Amount"/>
        <parameter key="replace_what" value="Fail"/>
        <parameter key="replace_by" value="0"/>
      </operator>
      <operator activated="true" class="parse_numbers" compatibility="7.4.000" expanded="true" height="82" name="Parse Numbers (3)" width="90" x="45" y="340">
        <parameter key="attribute_filter_type" value="single"/>
        <parameter key="attribute" value="Amount"/>
        <parameter key="grouped_digits" value="true"/>
        <parameter key="unparsable_value_handling" value="replace with missing values"/>
      </operator>
      <operator activated="true" class="aggregate" compatibility="7.4.000" expanded="true" height="82" name="Aggregate (2)" width="90" x="179" y="34">
        <parameter key="use_default_aggregation" value="true"/>
        <parameter key="attribute_filter_type" value="single"/>
        <parameter key="attribute" value="Status"/>
        <parameter key="default_aggregation_function" value="sum"/>
        <list key="aggregation_attributes">
          <parameter key="Amount" value="sum"/>
        </list>
        <parameter key="group_by_attributes" value="Id|Item"/>
      </operator>
      <operator activated="true" class="pivot" compatibility="7.4.000" expanded="true" height="82" name="Pivot (2)" width="90" x="179" y="136">
        <parameter key="group_attribute" value="Id"/>
        <parameter key="index_attribute" value="Item"/>
      </operator>
      <operator activated="true" class="rename_by_replacing" compatibility="7.4.000" expanded="true" height="82" name="Rename by Replacing" width="90" x="179" y="238">
        <parameter key="include_special_attributes" value="true"/>
        <parameter key="replace_what" value="sum[-!&quot;#$%&amp;'()*+,./:;&lt;=&gt;?@\[\\\]_`{|}~]Amount[-!&quot;#$%&amp;'()*+,./:;&lt;=&gt;?@\[\\\]_`{|}~]_"/>
        <parameter key="replace_by" value=" "/>
      </operator>
      <operator activated="true" class="numerical_to_binominal" compatibility="7.4.000" expanded="true" height="82" name="Numerical to Binominal" width="90" x="179" y="340"/>
      <operator activated="true" class="set_role" compatibility="7.4.000" expanded="true" height="82" name="Set Role" width="90" x="313" y="34">
        <parameter key="attribute_name" value="Id"/>
        <parameter key="target_role" value="id"/>
        <list key="set_additional_roles"/>
      </operator>
      <operator activated="true" class="handle_exception" compatibility="7.4.000" expanded="true" height="82" name="Handle Exception" width="90" x="313" y="136">
        <parameter key="exception_macro" value="exp"/>
        <process expanded="true">
          <operator activated="true" class="concurrency:loop_attributes" compatibility="7.4.000" expanded="true" height="82" name="Loop Attributes" width="90" x="112" y="34">
            <parameter key="attributes" value="Id"/>
            <process expanded="true">
              <operator activated="true" class="rename" compatibility="7.4.000" expanded="true" height="82" name="Rename" width="90" x="313" y="34">
                <parameter key="old_name" value="Id"/>
                <parameter key="new_name" value="lesson id"/>
                <list key="rename_additional_attributes">
                  <parameter key="321-8354" value="stefania"/>
                  <parameter key="321-1200" value="stefania2"/>
                </list>
              </operator>
              <connect from_port="input 1" to_op="Rename" to_port="example set input"/>
              <connect from_op="Rename" 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>
          <connect from_port="in 1" to_op="Loop Attributes" to_port="input 1"/>
          <connect from_op="Loop Attributes" from_port="output 1" to_port="out 1"/>
          <portSpacing port="source_in 1" spacing="0"/>
          <portSpacing port="source_in 2" spacing="0"/>
          <portSpacing port="sink_out 1" spacing="0"/>
          <portSpacing port="sink_out 2" spacing="0"/>
        </process>
        <process expanded="true">
          <operator activated="false" class="print_to_console" compatibility="7.4.000" expanded="true" height="68" name="Print to Console" width="90" x="112" y="34">
            <parameter key="log_value" value="%{exp}"/>
          </operator>
          <connect from_port="in 1" to_port="out 1"/>
          <portSpacing port="source_in 1" spacing="0"/>
          <portSpacing port="source_in 2" spacing="0"/>
          <portSpacing port="sink_out 1" spacing="0"/>
          <portSpacing port="sink_out 2" spacing="0"/>
        </process>
      </operator>
      <operator activated="false" class="select" compatibility="7.4.000" expanded="true" height="68" name="Select" width="90" x="313" y="391"/>
      <operator activated="true" class="fp_growth" compatibility="7.4.000" expanded="true" height="82" name="FP-Growth" width="90" x="447" y="34">
        <parameter key="find_min_number_of_itemsets" value="false"/>
        <parameter key="positive_value" value="true"/>
        <parameter key="min_support" value="0.005"/>
      </operator>
      <operator activated="true" class="create_association_rules" compatibility="7.4.000" expanded="true" height="82" name="Create Association Rules" width="90" x="447" y="238"/>
      <operator activated="false" class="store" compatibility="7.4.000" expanded="true" height="68" name="Store" width="90" x="447" y="391">
        <parameter key="repository_entry" value="../data/test1Data"/>
      </operator>
      <operator activated="false" class="read_excel" compatibility="7.4.000" expanded="true" height="68" name="Read Excel" width="90" x="45" y="442">
        <list key="annotations"/>
        <list key="data_set_meta_data_information"/>
      </operator>
      <connect from_op="Read Database" from_port="output" to_op="Replace (1)" to_port="example set input"/>
      <connect from_op="Replace (1)" from_port="example set output" to_op="Replace (3)" to_port="example set input"/>
      <connect from_op="Replace (3)" from_port="example set output" to_op="Parse Numbers (3)" to_port="example set input"/>
      <connect from_op="Parse Numbers (3)" from_port="example set output" to_op="Aggregate (2)" to_port="example set input"/>
      <connect from_op="Aggregate (2)" from_port="example set output" to_op="Pivot (2)" to_port="example set input"/>
      <connect from_op="Pivot (2)" from_port="example set output" to_op="Rename by Replacing" to_port="example set input"/>
      <connect from_op="Rename by Replacing" from_port="example set output" to_op="Numerical to Binominal" to_port="example set input"/>
      <connect from_op="Numerical to Binominal" 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="Handle Exception" to_port="in 1"/>
      <connect from_op="Handle Exception" from_port="out 1" to_op="FP-Growth" to_port="example set"/>
      <connect from_op="FP-Growth" from_port="frequent sets" to_op="Create Association Rules" to_port="item sets"/>
      <connect from_op="Create Association Rules" from_port="rules" 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>

Any ideas how to fix this? I run out of ideas.

 

Thanks,

stfn

3 REPLIES
RM Certified Expert
RM Certified Expert

Re: Association Rules Renaming results

Use the Converters extension and conver them Assoc rules to an example set. Then use Replace (Dictionary) operator to mass convert your numbers. 

 

Isn't this question similar to http://community.rapidminer.com/t5/RapidMiner-Studio-Forum/Rename-Premises-and-Conclusion-of-Associa... ?

Contributor II stfn
Contributor II
Solution

Re: Association Rules Renaming results

Hello Thomas

 

Yes it is almost the same but did not fingure how to do this so i made a different post.

It didn't work =/

RM Certified Expert
RM Certified Expert

Re: Association Rules Renaming results

You need to use Replace (Dictionary) if you want to rename them OR just have your data source convert them before you load it into RapidMiner. 

Twitter Feed