MCPcopy Create free account
hub / github.com/WinVector/Logistic / reduce

Method reduce

src/com/winvector/logistic/mr/MapRedFn.java:266–275  ·  view source on GitHub ↗
(final Text key, final Iterable<DoubleWritable> values, final Context context)

Source from the content-addressed store, hash-verified

264
265 public static final class SumReducer extends Reducer<Text,DoubleWritable,Text,DoubleWritable> { // TODO: check if there is a standard summer we could use here
266 @Override
267 public void reduce(final Text key, final Iterable<DoubleWritable> values, final Context context) throws IOException, InterruptedException {
268 double total = 0.0;
269 for(final DoubleWritable vi: values) {
270 total += vi.get();
271 }
272 if(total!=0.0) {
273 context.write(new Text(key.toString()),new DoubleWritable(total));
274 }
275 }
276 }
277
278 @Override

Callers

nothing calls this directly

Calls 3

getMethod · 0.45
writeMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected