Examples of adjustOrPutValue()


Examples of gnu.trove.TIntIntHashMap.adjustOrPutValue()

      // Sample a topic assignment from this distribution
      newTopic = random.nextDiscrete (topicWeights, topicWeightsSum);

      // Put that new topic into the counts
      oneDocTopics[si] = newTopic;
      currentTypeTopicCounts.adjustOrPutValue(newTopic, 1, 1);
      localTopicCounts[newTopic] ++;
      tokensPerTopic[newTopic]++;
    }
  }
 
View Full Code Here

Examples of gnu.trove.TIntIntHashMap.adjustOrPutValue()

      // Sample a topic assignment from this distribution
      newTopic = random.nextDiscrete (topicWeights, topicWeightsSum);

      // Put that new topic into the counts
      oneDocTopics[si] = newTopic;
      currentTypeTopicCounts.adjustOrPutValue(newTopic, 1, 1);
      localTopicCounts[newTopic] ++;
      tokensPerTopic[newTopic]++;
    }
  }
View Full Code Here

Examples of gnu.trove.TIntIntHashMap.adjustOrPutValue()

      // Sample a topic assignment from this distribution
      newTopic = random.nextDiscrete (topicWeights, topicWeightsSum);

      // Put that new topic into the counts
      oneDocTopics[si] = newTopic;
      currentTypeTopicCounts.adjustOrPutValue(newTopic, 1, 1);
      tokensPerTopic[newTopic]++;
    }
  }

  //print human readable doc-topic matrix, for further IR use
View Full Code Here

Examples of gnu.trove.TIntIntHashMap.adjustOrPutValue()

      smoothingOnlyMass -= alpha[newTopic] * beta /
        (tokensPerTopic[newTopic] + betaSum);
      topicBetaMass -= beta * localTopicCounts.get(newTopic) /
        (tokensPerTopic[newTopic] + betaSum);

      localTopicCounts.adjustOrPutValue(newTopic, 1, 1);
      tokensPerTopic[newTopic]++;

      //      update the coefficients for the non-zero topics
      cachedCoefficients[newTopic] =
        (alpha[newTopic] + localTopicCounts.get(newTopic)) /
View Full Code Here

Examples of gnu.trove.TIntIntHashMap.adjustOrPutValue()

   
    for (Instance instance: instances) {
      FeatureSequence features = (FeatureSequence) instance.getData();
           
      for (int i=0; i<features.getLength(); i++) {
        docCounts.adjustOrPutValue(features.getIndexAtPosition(i), 1, 1);
      }
           
      int[] keys = docCounts.keys();
      for (int i = 0; i < keys.length - 1; i++) {
        int feature = keys[i];
View Full Code Here

Examples of gnu.trove.TIntIntHashMap.adjustOrPutValue()

      assert (currentTypeTopicCounts.size() != 0);

      if (readjustTopicsAndStats) {
        // Remove this token from all counts
        oneDocTopicCounts[oldTopic]--;
        adjustedValue = currentTypeTopicCounts.adjustOrPutValue(oldTopic, -1, -1);
        if (adjustedValue == 0) currentTypeTopicCounts.remove(oldTopic);
        else if (adjustedValue == -1) throw new IllegalStateException ("Token count in topic went negative.");
        tokensPerTopic[oldTopic]--;
      }
View Full Code Here

Examples of gnu.trove.TIntIntHashMap.adjustOrPutValue()

    int docLength = tokenSequence.getLength();

    //    populate topic counts
    TIntIntHashMap localTopicCounts = new TIntIntHashMap();
    for (int position = 0; position < docLength; position++) {
      localTopicCounts.adjustOrPutValue(oneDocTopics[position], 1, 1);
    }

    //    Initialize the topic count/beta sampling bucket
    double topicBetaMass = 0.0;
    for (int topic: localTopicCounts.keys()) {
View Full Code Here

Examples of gnu.trove.TIntIntHashMap.adjustOrPutValue()

      while(ip.next() != IterablePosting.EOL)
      {
        //System.err.println("Got id " + ip.getId());
        assertTrue("Got too big a docid ("+ip.getId()+") from inverted index input stream for term at index " + ithTerm, ip.getId() < numDocs);
        count++;
        calculatedDocLengths.adjustOrPutValue(ip.getId(), ip.getFrequency(), ip.getFrequency());
      }
      assertEquals(expected, count);
    }
    assertEquals("Number of documents is unexpected,", documentLengths.length - countZero(documentLengths), calculatedDocLengths.size());
    long tokens = 0;
View Full Code Here

Examples of gnu.trove.map.TDoubleDoubleMap.adjustOrPutValue()

      double count = iterator.value();
      for (int letter = 0; letter < 4; ++letter) {
        double new_score = score + column[letter];
        if (new_score >= least_sufficient) {
          double add = count * background.count(letter);
          new_scores.adjustOrPutValue(new_score, add, add);
        }
      }
    }
    return new_scores;
  }
View Full Code Here

Examples of gnu.trove.map.TDoubleDoubleMap.adjustOrPutValue()

      TDoubleDoubleIterator iterator = scores[i].iterator();
      while(iterator.hasNext()) {
        iterator.advance();
        double score = iterator.key();
        double count = iterator.value();
        combined_scores.adjustOrPutValue(score, count, count);
      }
    }
    return combined_scores;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.