Creating Hash table for counting pairs, triplets,… in frequent itemset mining









up vote
0
down vote

favorite












import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class FreqItemset

// method to read parameters of file ( bucket and min sup)
public int no_of_baskets_and_minsup(BufferedReader br) throws IOException
String line1 = br.readLine();
return new int Integer.parseInt(line1.split(" ")[0]), Integer.parseInt(line1.split(" ")[1]);


public void pass1(String file)

try
BufferedReader inputbr = new BufferedReader(new FileReader(file));
int res = no_of_baskets_and_minsup(inputbr);
int baskets = res[0];
int minsup = res[1];
System.out.println("Number of bukcets:"+baskets);
System.out.println("Min support is:"+minsup);

//pass 1 logic
String basket=null;
int unique_items = new int[100];
while( (basket = inputbr.readLine()) !=null ) // for each basket

String temp = basket.split(",");
for(int i =1; i<temp.length; i++) // for each item in basket

unique_items[Integer.parseInt(temp[i])]++; // increment counts


//todo create hashtable maintaing bukcet and count

//For each pair of items in a basket..
// hash the pair to a bukce;
// add 1 to the count of that bukcet;

catch (Exception ex)
System.out.println("Something wrong in Phase 1 :" + ex.getMessage() + "nn" + ex.getStackTrace());




public static void main(String args)

String filename = "input.txt";
long t1= System.currentTimeMillis();
FreqItemset obj = new FreqItemset();
obj.pass1(filename);
long t2= System.currentTimeMillis();
System.out.println("Time mili "+(t2-t1));




In implementing the PCY algorithm with Multihash technique for Frquent itemset mining .. in the pass 1 i need have created an array of 1-itemsets and their counts. Now i need to consider each pair from each basket and hash it to bucket using a hash function. I have to create 2 has tables in Pass 1 ( multihash PCY).



I am unable to figure a way : given a pair i,j of items how shoud i implement hash-table using my own has function like eg. (i*j)%51 and other similar one for second hash-table.



I read alot about hashing hashtables but didnt find a way out .










share|improve this question



























    up vote
    0
    down vote

    favorite












    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.IOException;

    public class FreqItemset

    // method to read parameters of file ( bucket and min sup)
    public int no_of_baskets_and_minsup(BufferedReader br) throws IOException
    String line1 = br.readLine();
    return new int Integer.parseInt(line1.split(" ")[0]), Integer.parseInt(line1.split(" ")[1]);


    public void pass1(String file)

    try
    BufferedReader inputbr = new BufferedReader(new FileReader(file));
    int res = no_of_baskets_and_minsup(inputbr);
    int baskets = res[0];
    int minsup = res[1];
    System.out.println("Number of bukcets:"+baskets);
    System.out.println("Min support is:"+minsup);

    //pass 1 logic
    String basket=null;
    int unique_items = new int[100];
    while( (basket = inputbr.readLine()) !=null ) // for each basket

    String temp = basket.split(",");
    for(int i =1; i<temp.length; i++) // for each item in basket

    unique_items[Integer.parseInt(temp[i])]++; // increment counts


    //todo create hashtable maintaing bukcet and count

    //For each pair of items in a basket..
    // hash the pair to a bukce;
    // add 1 to the count of that bukcet;

    catch (Exception ex)
    System.out.println("Something wrong in Phase 1 :" + ex.getMessage() + "nn" + ex.getStackTrace());




    public static void main(String args)

    String filename = "input.txt";
    long t1= System.currentTimeMillis();
    FreqItemset obj = new FreqItemset();
    obj.pass1(filename);
    long t2= System.currentTimeMillis();
    System.out.println("Time mili "+(t2-t1));




    In implementing the PCY algorithm with Multihash technique for Frquent itemset mining .. in the pass 1 i need have created an array of 1-itemsets and their counts. Now i need to consider each pair from each basket and hash it to bucket using a hash function. I have to create 2 has tables in Pass 1 ( multihash PCY).



    I am unable to figure a way : given a pair i,j of items how shoud i implement hash-table using my own has function like eg. (i*j)%51 and other similar one for second hash-table.



    I read alot about hashing hashtables but didnt find a way out .










    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      import java.io.BufferedReader;
      import java.io.FileReader;
      import java.io.IOException;

      public class FreqItemset

      // method to read parameters of file ( bucket and min sup)
      public int no_of_baskets_and_minsup(BufferedReader br) throws IOException
      String line1 = br.readLine();
      return new int Integer.parseInt(line1.split(" ")[0]), Integer.parseInt(line1.split(" ")[1]);


      public void pass1(String file)

      try
      BufferedReader inputbr = new BufferedReader(new FileReader(file));
      int res = no_of_baskets_and_minsup(inputbr);
      int baskets = res[0];
      int minsup = res[1];
      System.out.println("Number of bukcets:"+baskets);
      System.out.println("Min support is:"+minsup);

      //pass 1 logic
      String basket=null;
      int unique_items = new int[100];
      while( (basket = inputbr.readLine()) !=null ) // for each basket

      String temp = basket.split(",");
      for(int i =1; i<temp.length; i++) // for each item in basket

      unique_items[Integer.parseInt(temp[i])]++; // increment counts


      //todo create hashtable maintaing bukcet and count

      //For each pair of items in a basket..
      // hash the pair to a bukce;
      // add 1 to the count of that bukcet;

      catch (Exception ex)
      System.out.println("Something wrong in Phase 1 :" + ex.getMessage() + "nn" + ex.getStackTrace());




      public static void main(String args)

      String filename = "input.txt";
      long t1= System.currentTimeMillis();
      FreqItemset obj = new FreqItemset();
      obj.pass1(filename);
      long t2= System.currentTimeMillis();
      System.out.println("Time mili "+(t2-t1));




      In implementing the PCY algorithm with Multihash technique for Frquent itemset mining .. in the pass 1 i need have created an array of 1-itemsets and their counts. Now i need to consider each pair from each basket and hash it to bucket using a hash function. I have to create 2 has tables in Pass 1 ( multihash PCY).



      I am unable to figure a way : given a pair i,j of items how shoud i implement hash-table using my own has function like eg. (i*j)%51 and other similar one for second hash-table.



      I read alot about hashing hashtables but didnt find a way out .










      share|improve this question















      import java.io.BufferedReader;
      import java.io.FileReader;
      import java.io.IOException;

      public class FreqItemset

      // method to read parameters of file ( bucket and min sup)
      public int no_of_baskets_and_minsup(BufferedReader br) throws IOException
      String line1 = br.readLine();
      return new int Integer.parseInt(line1.split(" ")[0]), Integer.parseInt(line1.split(" ")[1]);


      public void pass1(String file)

      try
      BufferedReader inputbr = new BufferedReader(new FileReader(file));
      int res = no_of_baskets_and_minsup(inputbr);
      int baskets = res[0];
      int minsup = res[1];
      System.out.println("Number of bukcets:"+baskets);
      System.out.println("Min support is:"+minsup);

      //pass 1 logic
      String basket=null;
      int unique_items = new int[100];
      while( (basket = inputbr.readLine()) !=null ) // for each basket

      String temp = basket.split(",");
      for(int i =1; i<temp.length; i++) // for each item in basket

      unique_items[Integer.parseInt(temp[i])]++; // increment counts


      //todo create hashtable maintaing bukcet and count

      //For each pair of items in a basket..
      // hash the pair to a bukce;
      // add 1 to the count of that bukcet;

      catch (Exception ex)
      System.out.println("Something wrong in Phase 1 :" + ex.getMessage() + "nn" + ex.getStackTrace());




      public static void main(String args)

      String filename = "input.txt";
      long t1= System.currentTimeMillis();
      FreqItemset obj = new FreqItemset();
      obj.pass1(filename);
      long t2= System.currentTimeMillis();
      System.out.println("Time mili "+(t2-t1));




      In implementing the PCY algorithm with Multihash technique for Frquent itemset mining .. in the pass 1 i need have created an array of 1-itemsets and their counts. Now i need to consider each pair from each basket and hash it to bucket using a hash function. I have to create 2 has tables in Pass 1 ( multihash PCY).



      I am unable to figure a way : given a pair i,j of items how shoud i implement hash-table using my own has function like eg. (i*j)%51 and other similar one for second hash-table.



      I read alot about hashing hashtables but didnt find a way out .







      java apriori






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 10 at 0:08









      Harry Coder

      2001417




      2001417










      asked Nov 9 at 21:07









      ADITYA SURVE

      13




      13



























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233284%2fcreating-hash-table-for-counting-pairs-triplets-in-frequent-itemset-mining%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233284%2fcreating-hash-table-for-counting-pairs-triplets-in-frequent-itemset-mining%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo