SortedSet<WordWeight> wordWeights = new TreeSet<WordWeight>(); for(int wordId = 0 ; wordId < model.numFeatures() ; wordId++) { WordWeight w = new WordWeight(wordId, model.weight(labelId, wordId)); wordWeights.add(w);
@Override public double getScoreForLabelFeature(int label, int feature) { NaiveBayesModel model = getModel(); // Standard Naive Bayes does not use weight normalization return computeWeight(model.weight(label, feature), model.labelWeight(label), model.alphaI(), model.numFeatures()); }
@Override public double getScoreForLabelFeature(int label, int feature) { NaiveBayesModel model = getModel(); // Standard Naive Bayes does not use weight normalization return computeWeight(model.weight(label, feature), model.labelWeight(label), model.alphaI(), model.numFeatures()); }
@Override public double getScoreForLabelFeature(int label, int feature) { NaiveBayesModel model = getModel(); return computeWeight(model.weight(label, feature), model.labelWeight(label), model.alphaI(), model.numFeatures()); }
@Override public double getScoreForLabelFeature(int label, int feature) { NaiveBayesModel model = getModel(); return computeWeight(model.featureWeight(feature), model.weight(label, feature), model.totalWeightSum(), model.labelWeight(label), model.alphaI(), model.numFeatures()); }
@Override public double getScoreForLabelFeature(int label, int feature) { NaiveBayesModel model = getModel(); double weight = computeWeight(model.featureWeight(feature), model.weight(label, feature), model.totalWeightSum(), model.labelWeight(label), model.alphaI(), model.numFeatures()); // see http://people.csail.mit.edu/jrennie/papers/icml03-nb.pdf - Section 3.2, Weight Magnitude Errors return weight / model.thetaNormalizer(label); }
@Override public double getScoreForLabelFeature(int label, int feature) { NaiveBayesModel model = getModel(); double weight = computeWeight(model.featureWeight(feature), model.weight(label, feature), model.totalWeightSum(), model.labelWeight(label), model.alphaI(), model.numFeatures()); // see http://people.csail.mit.edu/jrennie/papers/icml03-nb.pdf - Section 3.2, Weight Magnitude Errors return weight / model.thetaNormalizer(label); }