All pastes #749154 Raw Edit

Someone

public text v1 · immutable
#749154 ·published 2007-10-25 13:48 UTC
rendered paste body
  public double documentProbability(TermDocs featureDocs, TermDocs classDocs, Map<Term, Double> features, String _class, double assumedFeatureWeight, double assumedFeatureProbability, boolean normalized) throws IOException {
    double ret = 1;
    for (Map.Entry<Term, Double> featureFrequency : features.entrySet()) {
      // hmm, not sure about my skills here.. is this pow the same thing as calling once per occurance?
      ret *= Math.pow(weightedFeatureProbability(featureDocs, classDocs, featureFrequency.getKey(), _class, assumedFeatureWeight, assumedFeatureProbability, normalized), featureFrequency.getValue());
    }
    return ret;
  }