store association rules into mysql table

asmahassani08
asmahassani08 New Altair Community Member
edited November 5 in Community Q&A

hello, 

I need to export fp-growth association rules to MySQL database.

the MySQL table contains those columns: premises, conclusion, support, confidence

how can i solve it ?

thnx

 

Best Answer

  • David_A
    David_A New Altair Community Member
    Answer ✓

    Hi,

     

    Martin is right.

    You can use the "Association Rules to ExampleSet" Operator from the Converters extension, available at the RapidMiner marketplace. The relevant attributes from the resulting example set can be easily stored in a database. See the sample process below for an example.

     

    <?xml version="1.0" encoding="UTF-8"?><process version="9.0.002">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="6.0.002" expanded="true" name="Process" origin="GENERATED_TUTORIAL">
    <process expanded="true">
    <operator activated="true" class="retrieve" compatibility="9.0.002" expanded="true" height="68" name="Iris" origin="GENERATED_TUTORIAL" width="90" x="45" y="120">
    <parameter key="repository_entry" value="//Samples/data/Iris"/>
    </operator>
    <operator activated="true" class="discretize_by_frequency" compatibility="7.1.001" expanded="true" height="103" name="Discretize by Frequency" origin="GENERATED_TUTORIAL" width="90" x="179" y="120">
    <parameter key="number_of_bins" value="5"/>
    <parameter key="range_name_type" value="short"/>
    </operator>
    <operator activated="true" class="nominal_to_binominal" compatibility="7.1.001" expanded="true" height="103" name="Nominal to Binominal" origin="GENERATED_TUTORIAL" width="90" x="313" y="120">
    <parameter key="transform_binominal" value="true"/>
    <parameter key="use_underscore_in_name" value="true"/>
    </operator>
    <operator activated="true" class="concurrency:fp_growth" compatibility="9.0.002" expanded="true" height="82" name="FPGrowth" origin="GENERATED_TUTORIAL" width="90" x="447" y="120">
    <parameter key="min_support" value="0.1"/>
    <parameter key="find_min_number_of_itemsets" value="false"/>
    <parameter key="min_number_of_itemsets" value="1"/>
    <enumeration key="must_contain_list"/>
    </operator>
    <operator activated="true" class="create_association_rules" compatibility="9.0.002" expanded="true" height="82" name="Create Association Rules" origin="GENERATED_TUTORIAL" width="90" x="581" y="120"/>
    <operator activated="true" class="converters:rules_2_example_set" compatibility="0.4.000" expanded="true" height="82" name="Association Rules to ExampleSet" width="90" x="782" y="136"/>
    <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_port="result 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="90"/>
    <portSpacing port="sink_result 2" spacing="18"/>
    </process>
    </operator>
    </process>

Answers

  • MartinLiebig
    MartinLiebig
    Altair Employee

    Hi,

    i think converts extension has a proper converter for this.

     

    BR,

    Martin

  • David_A
    David_A New Altair Community Member
    Answer ✓

    Hi,

     

    Martin is right.

    You can use the "Association Rules to ExampleSet" Operator from the Converters extension, available at the RapidMiner marketplace. The relevant attributes from the resulting example set can be easily stored in a database. See the sample process below for an example.

     

    <?xml version="1.0" encoding="UTF-8"?><process version="9.0.002">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="6.0.002" expanded="true" name="Process" origin="GENERATED_TUTORIAL">
    <process expanded="true">
    <operator activated="true" class="retrieve" compatibility="9.0.002" expanded="true" height="68" name="Iris" origin="GENERATED_TUTORIAL" width="90" x="45" y="120">
    <parameter key="repository_entry" value="//Samples/data/Iris"/>
    </operator>
    <operator activated="true" class="discretize_by_frequency" compatibility="7.1.001" expanded="true" height="103" name="Discretize by Frequency" origin="GENERATED_TUTORIAL" width="90" x="179" y="120">
    <parameter key="number_of_bins" value="5"/>
    <parameter key="range_name_type" value="short"/>
    </operator>
    <operator activated="true" class="nominal_to_binominal" compatibility="7.1.001" expanded="true" height="103" name="Nominal to Binominal" origin="GENERATED_TUTORIAL" width="90" x="313" y="120">
    <parameter key="transform_binominal" value="true"/>
    <parameter key="use_underscore_in_name" value="true"/>
    </operator>
    <operator activated="true" class="concurrency:fp_growth" compatibility="9.0.002" expanded="true" height="82" name="FPGrowth" origin="GENERATED_TUTORIAL" width="90" x="447" y="120">
    <parameter key="min_support" value="0.1"/>
    <parameter key="find_min_number_of_itemsets" value="false"/>
    <parameter key="min_number_of_itemsets" value="1"/>
    <enumeration key="must_contain_list"/>
    </operator>
    <operator activated="true" class="create_association_rules" compatibility="9.0.002" expanded="true" height="82" name="Create Association Rules" origin="GENERATED_TUTORIAL" width="90" x="581" y="120"/>
    <operator activated="true" class="converters:rules_2_example_set" compatibility="0.4.000" expanded="true" height="82" name="Association Rules to ExampleSet" width="90" x="782" y="136"/>
    <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_port="result 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="90"/>
    <portSpacing port="sink_result 2" spacing="18"/>
    </process>
    </operator>
    </process>
  • asmahassani08
    asmahassani08 New Altair Community Member
    hello, 
    I do as you say, but with another process, I have this error :
           Expected AssociationRules but received IOObjectCollection
    details of the input of the operator :
    Association Rules to ExampleSet.rules input (rules input)
    Meta data: Collection of Association Rules
    Generated by: Radoop Nest.output 2
    expects: AssociationRules, expects: AssociationRules     

    It worked fine, but since I change the version from 9 to 9.2 I have this problem.
    What can be the cause, please?