Path path = new Path(statePath, "part-" + k);
SequenceFile.Writer writer = new SequenceFile.Writer(fs, job, path, IntPairWritable.class, DoubleWritable.class);
try {
for (int w = 0; w < state.getNumWords(); ++w) {
Writable kw = new IntPairWritable(k, w);
v.set(state.logProbWordGivenTopic(w,k) + state.getLogTotal(k));
writer.append(kw, v);
}
Writable kTsk = new IntPairWritable(k, TOPIC_SUM_KEY);
v.set(state.getLogTotal(k));
writer.append(kTsk, v);
} finally {
Closeables.closeQuietly(writer);
}
}
Path path = new Path(statePath, "part-" + LOG_LIKELIHOOD_KEY);
SequenceFile.Writer writer = new SequenceFile.Writer(fs, job, path, IntPairWritable.class, DoubleWritable.class);
try {
Writable kTsk = new IntPairWritable(LOG_LIKELIHOOD_KEY,LOG_LIKELIHOOD_KEY);
v.set(state.getLogLikelihood());
writer.append(kTsk, v);
} finally {
Closeables.closeQuietly(writer);
}