| 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 |