Package ivory.lsh.data

Examples of ivory.lsh.data.PermutationByBit


    if(fs.exists(new Path(randomPermFile))){
      sLogger.info("Random permutations output path already exists!");
      return randomPermFile;
    }
    SequenceFile.Writer writer = SequenceFile.createWriter(fs, job, new Path(randomPermFile), IntWritable.class, ArrayListOfIntsWritable.class);
    Permutation p = new PermutationByBit(numBits);
    for(int i=0;i<numOfPermutations;i++){
      ArrayListOfIntsWritable perm = p.nextPermutation();
      writer.append(new IntWritable(i), perm);
      sLogger.debug(i +":"+perm);
    }
    writer.close();
    sLogger.info("Random permutations written.");
View Full Code Here


    PwsimEnvironment.numOfPermutations = 0//doesn't matter. not used to compute signatures
   
    if(fs.exists(new Path(randomPermFile))){
      sLogger.info("Random permutations output path already exists!");
    }else{
      Permutation p = new PermutationByBit(vocabSize);
      Permutation.writeToFile(p, numInts, fs, job, randomPermFile)
    }
    DistributedCache.addCacheFile(new URI(randomPermFile), job);

    sLogger.info("Computing signatures...");
View Full Code Here

    String randomPermFile = PwsimEnvironment.getPermutationsFile(dir, fs, vocabSize, numInts);

    if (fs.exists(new Path(randomPermFile))) {
      sLogger.info("Random permutations output path already exists!");
    } else {
      Permutation p = new PermutationByBit(vocabSize);
      Permutation.writeToFile(p, numInts, fs, job, randomPermFile);
    }
    DistributedCache.addCacheFile(new URI(randomPermFile), job);

    sLogger.info("Computing signatures...");
View Full Code Here

      return randomPermFile;
    }

    SequenceFile.Writer writer = SequenceFile.createWriter(fs, job, new Path(randomPermFile),
        IntWritable.class, ArrayListOfIntsWritable.class);
    Permutation p = new PermutationByBit(numBits);
    for (int i = 0; i < numOfPermutations; i++) {
      ArrayListOfIntsWritable perm = p.nextPermutation();
      writer.append(new IntWritable(i), perm);
      sLogger.debug(i + ":" + perm);
    }
    writer.close();
    sLogger.info("Random permutations written.");
View Full Code Here

    PwsimEnvironment.numOfPermutations = 0; // doesn't matter. not used to compute signatures

    if (fs.exists(new Path(randomPermFile))) {
      sLogger.info("Random permutations output path already exists!");
    } else {
      Permutation p = new PermutationByBit(vocabSize);
      Permutation.writeToFile(p, numInts, fs, job, randomPermFile);
    }
    DistributedCache.addCacheFile(new URI(randomPermFile), job);

    sLogger.info("Computing signatures...");
View Full Code Here

      sLogger.info("Random permutations output path already exists!");
      return randomPermFile;
    }
    SequenceFile.Writer writer = SequenceFile.createWriter(fs, job, new Path(randomPermFile),
        IntWritable.class, ArrayListOfIntsWritable.class);
    Permutation p = new PermutationByBit(numBits);
    for (int i = 0; i < numOfPermutations; i++) {
      ArrayListOfIntsWritable perm = p.nextPermutation();
      writer.append(new IntWritable(i), perm);
      sLogger.debug(i + ":" + perm);
    }
    writer.close();
    sLogger.info("Random permutations written.");
View Full Code Here

    return s;
  }

  @Test
  public void testPermute() throws IOException {
    PermutationByBit p = new PermutationByBit(D);

    MinhashSignature s = getRandomSignature();
    System.out.println(s);

    int loopcnt = 0;
    MinhashSignature permutedS = new MinhashSignature(D);
    while (loopcnt++ < 10) {
      ArrayListOfIntsWritable a = p.nextPermutation();
      s.perm(a, permutedS);
      for (int i = 0; i < s.size(); i++) {
        assertTrue(permutedS.containsTerm(s.get(i)));
      }
      assertTrue(permutedS.size() == s.size());
View Full Code Here

    return s;
  }

  @Test
  public void testPermuteBit() throws IOException {
    PermutationByBit p = new PermutationByBit(D);

    NBitSignature s = getRandomSignature();

    int cntBits = s.countSetBits();

    int loopcnt = 0;
    NBitSignature permutedS = new NBitSignature(D);
    while (loopcnt++ < 100) {
      ArrayListOfIntsWritable a = p.nextPermutation();
      s.perm(a, permutedS);
      System.out.println(permutedS.countSetBits());
      assertTrue(cntBits == permutedS.countSetBits());
      // System.out.println(permutedS);
    }
View Full Code Here

  //   
  // }

  @Test
  public void testSubSignature() {
    PermutationByBit p = new PermutationByBit(D);
    ArrayListOfIntsWritable a = p.nextPermutation();

    for (int i = 0; i < 100000; i++) {

      NBitSignature s = getRandomSignature();
View Full Code Here

    return s;
  }

  @Test
  public void testPermute() throws IOException {
    PermutationByBit p = new PermutationByBit(D);

    MinhashSignature s = getRandomSignature();
    System.out.println(s);

    int loopcnt = 0;
    MinhashSignature permutedS = new MinhashSignature(D);
    while (loopcnt++ < 10) {
      ArrayListOfIntsWritable a = p.nextPermutation();
      s.perm(a, permutedS);
      for (int i = 0; i < s.size(); i++) {
        assertTrue(permutedS.containsTerm(s.get(i)));
      }
      assertTrue(permutedS.size() == s.size());
View Full Code Here

TOP

Related Classes of ivory.lsh.data.PermutationByBit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.