double topicSmoothing = Double.parseDouble(job.get(TOPIC_SMOOTHING_KEY));
Path dir = new Path(statePath);
FileSystem fs = dir.getFileSystem(job);
DenseMatrix pWgT = new DenseMatrix(numTopics, numWords);
double[] logTotals = new double[numTopics];
double ll = 0.0;
IntPairWritable key = new IntPairWritable();
DoubleWritable value = new DoubleWritable();
for (FileStatus status : fs.globStatus(new Path(dir, "part-*"))) {
Path path = status.getPath();
SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, job);
while (reader.next(key, value)) {
int topic = key.getX();
int word = key.getY();
if (word == TOPIC_SUM_KEY) {
logTotals[topic] = value.get();
if (Double.isInfinite(value.get())) {
throw new IllegalArgumentException();
}
} else if (topic == LOG_LIKELIHOOD_KEY) {
ll = value.get();
} else {
//System.out.println(topic + " " + word);
if (!(topic >= 0 && word >= 0)) {
throw new IllegalArgumentException(topic + " " + word);
}
if (pWgT.getQuick(topic, word) != 0.0) {
throw new IllegalArgumentException();
}
pWgT.setQuick(topic, word, value.get());
if (Double.isInfinite(pWgT.getQuick(topic, word))) {
throw new IllegalArgumentException();
}
}
}
reader.close();