"Problem with association rules"

NinoNino Member Posts: 5 Learner I
edited June 2019 in Help

 Hi  everyone, i have a problem with the results of applying the module  "create association rule". After running the process, how do i to obtain only some rules with a specific conclusion and sorted by support in descending mode and export them into a Excel file? I didn't find a good way until now. Thank you very much!! 


  • lionelderkrikorlionelderkrikor Moderator, RapidMiner Certified Analyst, Member Posts: 1,195 Unicorn

    Hi @Nino,


    "Problem with association rules"....?


    ...There is no problem, there is (are) only solution(s)....:smileyhappy:


    More seriously, you can find here a process which perform what you want to do : 

    <?xml version="1.0" encoding="UTF-8"?><process version="8.1.003">
    <operator activated="true" class="process" compatibility="6.0.002" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="retrieve" compatibility="8.1.003" expanded="true" height="68" name="Iris" width="90" x="45" y="34">
    <parameter key="repository_entry" value="//Samples/data/Iris"/>
    <operator activated="true" class="discretize_by_frequency" compatibility="7.1.001" expanded="true" height="103" name="Discretize by Frequency" width="90" x="179" y="34">
    <parameter key="number_of_bins" value="5"/>
    <parameter key="range_name_type" value="short"/>
    <operator activated="true" class="nominal_to_binominal" compatibility="7.1.001" expanded="true" height="103" name="Nominal to Binominal" width="90" x="313" y="34">
    <parameter key="transform_binominal" value="true"/>
    <parameter key="use_underscore_in_name" value="true"/>
    <operator activated="true" class="fp_growth" compatibility="8.1.003" expanded="true" height="82" name="FPGrowth" width="90" x="447" y="34">
    <parameter key="find_min_number_of_itemsets" value="false"/>
    <parameter key="min_number_of_itemsets" value="1"/>
    <parameter key="min_support" value="0.1"/>
    <operator activated="true" class="create_association_rules" compatibility="8.1.003" expanded="true" height="82" name="Create Association Rules" width="90" x="581" y="34"/>
    <operator activated="true" class="converters:rules_2_example_set" compatibility="0.3.001" expanded="true" height="82" name="Association Rules to ExampleSet" width="90" x="715" y="34"/>
    <operator activated="true" class="concurrency:loop_values" compatibility="8.1.003" expanded="true" height="82" name="Loop Values" width="90" x="849" y="34">
    <parameter key="attribute" value="Conclusion"/>
    <process expanded="true">
    <operator activated="true" class="filter_examples" compatibility="8.1.003" expanded="true" height="103" name="Filter Examples" width="90" x="179" y="34">
    <list key="filters_list">
    <parameter key="filters_entry_key" value="Conclusion.equals.%{loop_value}"/>
    <operator activated="true" class="sort" compatibility="8.1.003" expanded="true" height="82" name="Sort" width="90" x="380" y="34">
    <parameter key="attribute_name" value="Support"/>
    <parameter key="sorting_direction" value="decreasing"/>
    <operator activated="true" class="write_excel" compatibility="8.1.003" expanded="true" height="82" name="Write Excel" width="90" x="581" y="34"/>
    <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="Sort" to_port="example set input"/>
    <connect from_op="Sort" from_port="example set output" to_op="Write Excel" to_port="input"/>
    <connect from_op="Write Excel" from_port="through" 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"/>
    <connect from_op="Iris" from_port="output" to_op="Discretize by Frequency" to_port="example set input"/>
    <connect from_op="Discretize by Frequency" from_port="example set output" to_op="Nominal to Binominal" to_port="example set input"/>
    <connect from_op="Nominal to Binominal" from_port="example set output" to_op="FPGrowth" to_port="example set"/>
    <connect from_op="FPGrowth" from_port="frequent sets" to_op="Create Association Rules" to_port="item sets"/>
    <connect from_op="Create Association Rules" from_port="rules" to_op="Association Rules to ExampleSet" to_port="rules input"/>
    <connect from_op="Association Rules to ExampleSet" from_port="example set" to_op="Loop Values" to_port="input 1"/>
    <connect from_op="Loop Values" from_port="output 1" to_port="result 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="90"/>
    <portSpacing port="sink_result 2" spacing="0"/>

    As we do not know a priori the conclusions and their number, we loop over all values of the Conclusion attribute.

    For example in this process, there are in fine 3 possible conclusions, so we create a collection of 3 ExampleSets and then we create 3 Excel files.


    I hope it helps.






    NB : This process is to adapted according to tyour data.

    NB2 : Don't forget to specifiy a path in the parameters of the Write Excel operator for the Excel files.


Sign In or Register to comment.