MCPcopy Index your code
hub / github.com/WinVector/Logistic / map

Method map

src/com/winvector/logistic/mr/MapRedFn.java:166–185  ·  view source on GitHub ↗
(final LongWritable key, final Text value, final Context context)

Source from the content-addressed store, hash-verified

164 }
165
166 @Override
167 public void map(final LongWritable key, final Text value, final Context context) {
168 final String origStr = value.toString();
169 final BurstMap parsed = burster.parse(origStr);
170 if(!parsed.isEmpty()) {
171 final String resStr = parsed.getAsString(config.defs.resultColumn);
172 if((resStr!=null)&&(resStr.length()>0)) {
173 final Integer category = defs.category(resStr.trim());
174 if((category!=null)&&(category>=0)) {
175 final SparseSemiVec v = defs.vector(parsed);
176 final double wt = defs.weight(parsed);
177 if((wt>0.0)&&(v!=null)) {
178 final ExampleRow r = new SparseExampleRow(v,wt,category);
179 config.underlying.addTerm(config.x, config.wantGrad, config.wantHessian, r, accum, pscratch);
180 ++nProcessed;
181 }
182 }
183 }
184 }
185 }
186
187 /**
188 * only write summing terms (fx,gx,hx) into Text,WritableDouble format

Callers

nothing calls this directly

Calls 5

vectorMethod · 0.80
categoryMethod · 0.65
weightMethod · 0.65
addTermMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected