Permalink
Browse files

Removing dead code from burrows delta.

  • Loading branch information...
mvryan committed Feb 3, 2017
1 parent 74f85d6 commit a55e44a3e6ce4669d063838d3fe1db218562111f
Showing with 2 additions and 10 deletions.
  1. +2 −10 src/com/jgaap/classifiers/BurrowsDelta.java
@@ -66,12 +66,7 @@ public void train(List<Document> knowns) {
for (Event event : events) {
List<Double> sample = new ArrayList<Double>();
for (EventMap histogram : knownCentroids.values()) {
- Double value = histogram.relativeFrequency(event);
- if (value == null) {
- sample.add(0.0);
- } else {
- sample.add(value);
- }
+ sample.add(histogram.relativeFrequency(event));
}
eventStddevBuilder.put(event, Utils.stddev(sample));
}
@@ -101,10 +96,7 @@ public void train(List<Document> knowns) {
for (Entry<String, EventMap> entry : knownCentroids.entrySet()) {
double delta = 0.0;
for (Event event : events) {
- Double knownFrequency = entry.getValue().relativeFrequency(event);
- if (knownFrequency == null) {
- knownFrequency = 0.0;
- }
+ double knownFrequency = entry.getValue().relativeFrequency(event);
delta += Math.abs((unknownEventMap.relativeFrequency(event) - knownFrequency) / eventStddev.get(event));
}
results.add(new Pair<String, Double>(entry.getKey(), delta,2));

0 comments on commit a55e44a

Please sign in to comment.