public class samReducer extends Reducer<Text, callingFunction, Text, Text> {
protected void reduce(Text key, Iterable<callingFunction> values, Context context)
throws IOException, InterruptedException {
// TODO Auto-generated method stub
Iterator<callingFunction> iterator = values.iterator();
String toPass = "";
int i = 0;
String tmp[] = new String[300];
//String temp = "";
while(iterator.hasNext())
{
/*toPass = iterator.next().toString()+ " ";
context.write(key , new Text((toPass)));*/
tmp[i++] = iterator.next().toString();
//i++;
}
for(i=0; i<300; i++)
context.write(key, new Text(tmp[i]));
}
}
我想在map reduce中将它用于反向传播算法。