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

Class SumReducer

src/com/winvector/logistic/mr/MapRedFn.java:265–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263 }
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
279 public VEval eval(final double[] x, final boolean wantGrad, final boolean wantHessian) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected