Revision 43433
Added by Giorgos Alexiou about 8 years ago
modules/dnet-openaire-lodinterlinking/trunk/src/main/java/eu/dnetlib/data/mapreduce/hbase/lodExport/utils/FrequencyCounter.java | ||
---|---|---|
120 | 120 |
TreeMap<BigInteger, Double> statistics = new TreeMap<BigInteger, Double>(); |
121 | 121 |
double CC = 0d; |
122 | 122 |
CC = 0d; |
123 |
int lastBlockSize = 2; |
|
124 | 123 |
int f; |
125 | 124 |
BigInteger totalSizeOfBlocks = BigInteger.ZERO; |
126 | 125 |
BigInteger numberOfComparisons = BigInteger.ZERO; |
... | ... | |
145 | 144 |
double eps = 1d; |
146 | 145 |
NavigableSet<BigInteger> keys = statistics.descendingKeySet(); |
147 | 146 |
for (BigInteger key : keys) { |
148 |
if (Math.abs(statistics.get(key) - statistics.get(key.subtract(BigInteger.ONE))) < eps) { |
|
149 |
eps = Math.abs(statistics.get(key) - statistics.get(key.subtract(BigInteger.ONE))); |
|
150 |
optimalBlockSize = Integer.valueOf(statistics.get(key).intValue()); |
|
147 |
double diff = Math.abs(statistics.get(key) - statistics.get(key.subtract(BigInteger.ONE))); |
|
148 |
if (diff < eps) { |
|
149 |
eps = diff; |
|
150 |
optimalBlockSize = Integer.valueOf(key.intValue()); |
|
151 | 151 |
} |
152 | 152 |
} |
153 | 153 |
|
Also available in: Unified diff
optimal algo fixed