}
public static void loadFeatureWeights(InMemoryBayesDatastore datastore,
FileSystem fs, Path pathPattern, Configuration conf) throws IOException {
StringTuple key = new StringTuple();
DoubleWritable value = new DoubleWritable();
FileStatus[] outputFiles = fs.globStatus(pathPattern);
for (FileStatus fileStatus : outputFiles) {
Path path = fileStatus.getPath();
log.info("{}", path);
SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, conf);
// the key is either _label_ or label,feature
long count = 0;
while (reader.next(key, value)) {
if (key.stringAt(0).equals(BayesConstants.FEATURE_SUM)) { // Sum of
// weights for
// a Feature
datastore.setSumFeatureWeight(key.stringAt(1), value.get());
count++;
if (count % 50000 == 0) {
log.info("Read {} feature weights", count);
}
}