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

Creating association rules using Rapid Miner. Please HELP

umangumang Member Posts: 5 Contributor II
edited February 2020 in Help
HI,

I am a final year student of master's of engineering in computer science & currently doing thesis work in Association rule data mining. I am stuck in a small problem regarding rapid miner. I want to apply FP- growth algorithm on 2 simple java programs using rapid miner to find Association rules, but i am not able to do so.
I want to apply FP growth algorithm on 2 java programs and find the association rules from them.

What i have done till now:-
1. Saved the two  programs in .txt files (Copied programs to notepad and saved it as program1.txt and program2.txt)
2. Selected the Process document from Files operator in rapid miner.
3. Then applied Tokenize operator, Filter token , Stem(snowball) and Transform cases operator [for processing the text].
4. After processing the text , I used Numerical to Binomial conversion operator.
5. After it, I aplied FP growth operator and lastly Create association rules operator.
6. Linked everything correctly.

All these steps were followed but "No rules found" comes up everytime.  :'( 
I tried the same procedure on a group of six simple C programs and it worked well. Rules were also framed well
. I don't understand why it is not working for two Java programs. If anybody there can help and guide me, i would be more than grateful.

The 2 java programs I am taking as input are stated below:

Program 1  :-

package codeclone;
import java.util.Scanner;
public class Example1 {

    public static void main(String[] args) {
        int  input;
        System.out.println("The super insano calculator");
        System.out.println("enter the corresponding number:");
        Scanner reader3 = new Scanner(System.in);
        System.out.println("1. Add | 2. Subtract | 3. Divide | 4.Multiply");

        input=reader3.nextInt();

        int a , b;

        Scanner reader = new Scanner(System.in);
        System.out.println("Enter the first number");
        //get user input for a
        a=reader.nextInt();


        Scanner reader1 = new Scanner(System.in);
        System.out.println("Enter the second number");
        //get user input for a
        b=reader1.nextInt();

        switch (input){
            case 1: System.out.println(a + " plus " + b + " equals " + add(a, b));          break;
            case 2: System.out.println(a + " minus " + b + " equals " + subtract(a, b));    break;
            case 3: System.out.println(a + " divided by " + b + " equals " + divide(a, b)); break;
            case 4: System.out.println(a + " times " + b + " equals " + multiply(a, b));    break;
            default: System.out.println("your input is invalid!");                          break;
        }
    }
    public static int add(int first, int second) {
            return first + second;
    }
    public static int subtract(int first, int second) {
            return first - second;
    }
    public static int divide(int first, int second) {
            return first / second;
    }
    public static int multiply(int first, int second) {
            return first * second;
    }
}




Program 2  :-


package codeclone;
import java.util.Scanner;
public class Example2 {

    public static void main(String[] args) {
        int  input;
     
        System.out.println("The super insano calculator");
        System.out.println("enter the corresponding number:");
        Scanner reader3 = new Scanner(System.in);
        System.out.println("1. Add | 2. Subtract | 3. Divide | 4.Multiply");

        input=reader3.nextInt();

        int c , d;

        Scanner reader = new Scanner(System.in);
        System.out.println("Enter the first number");
        //get user input for c
        c=reader.nextInt();


        Scanner reader1 = new Scanner(System.in);
        System.out.println("Enter the second number");
        //get user input for d
        d=reader1.nextInt();

        switch (input){
            case 1: System.out.println(c + " plus " + d + " equals " + ad(c, d));          break;
            case 2: System.out.println(c + " minus " + d + " equals " + sub(c, d));    break;
            case 3: System.out.println(c + " divided by " + d + " equals " + div(c, d)); break;
            case 4: System.out.println(c + " times " + d + " equals " + mul(c, d));    break;
            default: System.out.println("your input is invalid!");                          break;
        }
    }
    public static int ad(int fir, int sec) {
            return fir + sec;
    }
    public static int sub(int fir, int sec) {
            return fir - sec;
    }
    public static int div(int fir, int sec) {
            return fir / sec;
    }
    public static int mul(int fir, int sec) {
            return fir * sec;
    }
}


Can anybody please tell me what's wrong and why i am not able to find association rules.

Thank you for your consideration. Hope I get the response soon. It is urgent. A video or if not then a little bit of guidance will also help. I shall be more than grateful.
Regards
Umang

Answers

  • haddockhaddock Member Posts: 849 Maven
    Hi there,

    Association rules are a special interest of mine, so here's my two cents...

    If someone asked you to make rules from examining just two shopping baskets what would you say? Your two programs are two shopping baskets full of words, you need more! Just consider what conditions would need to be true for frequent item sets to get made, and no frequent itemsets means no rules, whatever the frequency threshold.

    Nice use of the technique, as mentioned it's a speciality of mine, check out my website, that does it on news.

    Best

    H

  • umangumang Member Posts: 5 Contributor II
    umang wrote:

    Hi,

    Following is the XML file of the work done by me in rapid miner. The two  java programs stated in the first post were taken as input for forming association rules. Please check why no rules are being made recommend editions. I am totally new to rapid miner.





    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="5.3.015">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="5.3.015" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="text:process_document_from_file" compatibility="5.3.002" expanded="true" height="76" name="Process Documents from Files" width="90" x="45" y="30">
            <list key="text_directories">
              <parameter key="help" value="C:\Users\Lenovo\Desktop\clone"/>
            </list>
            <parameter key="vector_creation" value="Binary Term Occurrences"/>
            <parameter key="keep_text" value="true"/>
            <parameter key="prune_method" value="absolute"/>
            <parameter key="prune_below_absolute" value="2"/>
            <parameter key="prune_above_absolute" value="30"/>
            <process expanded="true">
              <operator activated="true" class="text:tokenize" compatibility="5.3.002" expanded="true" height="60" name="Tokenize" width="90" x="45" y="30"/>
              <operator activated="true" class="text:filter_by_length" compatibility="5.3.002" expanded="true" height="60" name="Filter Tokens (by Length)" width="90" x="180" y="30">
                <parameter key="min_chars" value="2"/>
              </operator>
              <operator activated="true" class="text:stem_snowball" compatibility="5.3.002" expanded="true" height="60" name="Stem (Snowball)" width="90" x="315" y="30"/>
              <operator activated="true" class="text:transform_cases" compatibility="5.3.002" expanded="true" height="60" name="Transform Cases" width="90" x="447" y="30"/>
              <connect from_port="document" to_op="Tokenize" to_port="document"/>
              <connect from_op="Tokenize" from_port="document" to_op="Filter Tokens (by Length)" to_port="document"/>
              <connect from_op="Filter Tokens (by Length)" from_port="document" to_op="Stem (Snowball)" to_port="document"/>
              <connect from_op="Stem (Snowball)" from_port="document" to_op="Transform Cases" to_port="document"/>
              <connect from_op="Transform Cases" from_port="document" to_port="document 1"/>
              <portSpacing port="source_document" spacing="0"/>
              <portSpacing port="sink_document 1" spacing="0"/>
              <portSpacing port="sink_document 2" spacing="0"/>
            </process>
          </operator>
          <operator activated="true" class="numerical_to_binominal" compatibility="5.3.015" expanded="true" height="76" name="Numerical to Binominal" width="90" x="246" y="30"/>
          <operator activated="true" class="fp_growth" compatibility="5.3.015" expanded="true" height="76" name="FP-Growth" width="90" x="380" y="30">
            <parameter key="min_support" value="0.4"/>
          </operator>
          <operator activated="true" class="create_association_rules" compatibility="5.3.015" expanded="true" height="76" name="Create Association Rules" width="90" x="514" y="30">
            <parameter key="min_confidence" value="0.6"/>
          </operator>
          <connect from_port="input 1" to_op="Process Documents from Files" to_port="word list"/>
          <connect from_op="Process Documents from Files" from_port="example set" to_op="Numerical to Binominal" to_port="example set input"/>
          <connect from_op="Numerical to Binominal" from_port="example set output" 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"/>
          <connect from_op="Create Association Rules" from_port="item sets" to_port="result 2"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="source_input 2" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
          <portSpacing port="sink_result 3" spacing="0"/>
        </process>
      </operator>
    </process>

Sign In or Register to comment.