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

Association Rules With a Particular Structure in Rapid Minner

moeinmohebbimoeinmohebbi Member Posts: 2 Contributor I
edited November 2018 in Help
In Rapid Minner , I need to generate association rules with particular structure , such as :

[temp=cold, wind=slow] --> [rain=true] 
[temp=hot , wind=slow] --> [rain=false] 
[temp=cold, wind=fast] --> [rain=true]


That prediction of raining should be a part of the conclusion. I have studied Documentation of RapidMinner, it suggests to use Regular Expression in FP-Growth node (must contain a field). But it doesn't include any samples for using regular expression in association rules. I need a sample for using regular expressions (regex) in association rules.

Answers

  • haddockhaddock Member Posts: 849 Maven
    Hi there,

    Bear in mind that FPGrowth grows the Frequent Pattern tree, from which another operator creates the rules, so using the regex filter on FPGrowth will only ensure that the rules contain the term, it will not ensure that the rules contain the term as a conclusion, check this out...
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.013">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.013" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="retrieve" compatibility="5.3.013" expanded="true" height="60" name="Iris" width="90" x="45" y="120">
            <parameter key="repository_entry" value="//Samples/data/Iris"/>
          </operator>
          <operator activated="true" class="discretize_by_frequency" compatibility="5.3.013" expanded="true" height="94" name="Discretize by Frequency" 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="5.3.013" expanded="true" height="94" name="Nominal to Binominal" 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="fp_growth" compatibility="5.3.013" expanded="true" height="76" name="FPGrowth" width="90" x="447" y="120">
            <parameter key="find_min_number_of_itemsets" value="false"/>
            <parameter key="min_number_of_itemsets" value="1"/>
            <parameter key="min_support" value="0.1"/>
            <parameter key="must_contain" value="&quot;a1*|a2*&quot;"/>
          </operator>
          <operator activated="true" class="create_association_rules" compatibility="5.3.013" expanded="true" height="76" name="Create Association Rules" width="90" x="581" y="120"/>
          <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_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="108"/>
          <portSpacing port="sink_result 2" spacing="0"/>
        </process>
      </operator>
    </process>
    This means that you put the regex on the frequent itemset search, as a simple string i.e "REGEX", and the rules will contain matching terms, in my example that means " make me rules that contain a1, however it gets discretized". Don't forget the quotes!

    Going on to only use the rules whose conclusion matches the regex is actually quite tricky, a while back I posted a Groovy script to convert association rules to examples, that could help.

    Good luck!

    Shameless plug, if you want to see association rules done on news 24/7 check my link!

    H

    PS This machine has 5.3 ~ I think the operators work the same on 6.x

  • moeinmohebbimoeinmohebbi Member Posts: 2 Contributor I

    Thanks a lot

  • haddockhaddock Member Posts: 849 Maven
    Well done you for your thanks! Good manners are rare and welcome.

    H
Sign In or Register to comment.