MCPcopy Create free account
hub / github.com/antlr/codebuff / getCategoryRatios

Method getCategoryRatios

src/org/antlr/codebuff/validation/Entropy.java:227–235  ·  view source on GitHub ↗
(Collection<Integer> catCounts)

Source from the content-addressed store, hash-verified

225 }
226
227 public static List<Float> getCategoryRatios(Collection<Integer> catCounts) {
228 List<Float> ratios = new ArrayList<>();
229 int n = BuffUtils.sum(catCounts);
230 for (Integer count : catCounts) {
231 float probCat = count/(float) n;
232 ratios.add(probCat);
233 }
234 return ratios;
235 }
236
237 public static HashBag<Integer> getCategoriesBag(Collection<Integer> categories) {
238 HashBag<Integer> votes = new HashBag<>();

Callers 3

examineCorpusMethod · 0.95
computeConsistencyMethod · 0.80

Calls 2

sumMethod · 0.95
addMethod · 0.65

Tested by

no test coverage detected