Skip to content
This repository was archived by the owner on Nov 21, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main/java/cc/mrlda/DisplayTopic.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ public int run(String[] args) throws Exception {
System.exit(0);
}

JobConf conf = new JobConf(DisplayTopic.class);
JobConf conf = new JobConf(getConf());
conf.setJarByClass(getClass());
FileSystem fs = FileSystem.get(conf);

Path indexPath = new Path(indexString);
Expand Down Expand Up @@ -163,7 +164,7 @@ public int run(String[] args) throws Exception {
}

public static void main(String[] args) throws Exception {
int res = ToolRunner.run(new Configuration(), new DisplayTopic(), args);
int res = ToolRunner.run(new DisplayTopic(), args);
System.exit(res);
}
}
5 changes: 3 additions & 2 deletions src/main/java/cc/mrlda/InformedPrior.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public int run(String[] args) throws Exception {
}

// Delete the output directory if it exists already
JobConf conf = new JobConf(InformedPrior.class);
JobConf conf = new JobConf(getConf());
conf.setJarByClass(getClass());
FileSystem fs = FileSystem.get(conf);

Path inputPath = new Path(input);
Expand Down Expand Up @@ -202,7 +203,7 @@ public static HMapIV<Set<Integer>> importEta(SequenceFile.Reader sequenceFileRea
}

public static void main(String[] args) throws Exception {
int res = ToolRunner.run(new Configuration(), new InformedPrior(), args);
int res = ToolRunner.run(new InformedPrior(), args);
System.exit(res);
}
}
16 changes: 10 additions & 6 deletions src/main/java/cc/mrlda/ParseCorpus.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public int run(String[] args) throws Exception {
String indexPath = outputPath + INDEX;

// Delete the output directory if it exists already
FileSystem fs = FileSystem.get(new JobConf(ParseCorpus.class));
FileSystem fs = FileSystem.get(getConf());
fs.delete(new Path(outputPath), true);

try {
Expand Down Expand Up @@ -326,7 +326,8 @@ public PairOfInts tokenizeDocument(String inputPath, String outputPath, int numb
sLogger.info(" - number of mappers: " + numberOfMappers);
sLogger.info(" - number of reducers: " + numberOfReducers);

JobConf conf = new JobConf(ParseCorpus.class);
JobConf conf = new JobConf(getConf());
conf.setJarByClass(getClass());
conf.setJobName(ParseCorpus.class.getSimpleName() + " - tokenize document");
FileSystem fs = FileSystem.get(conf);

Expand Down Expand Up @@ -371,7 +372,8 @@ public PairOfInts tokenizeDocument(String inputPath, String outputPath, int numb

public Path indexTitle(String inputTitles, String outputTitle, int numberOfMappers)
throws Exception {
JobConf conf = new JobConf(ParseCorpus.class);
JobConf conf = new JobConf(getConf());
conf.setJarByClass(getClass());
FileSystem fs = FileSystem.get(conf);

Path titleIndexPath = new Path(outputTitle);
Expand Down Expand Up @@ -446,7 +448,8 @@ public Path indexTerm(String inputTerms, String outputTerm, int numberOfMappers,
Path inputTermFiles = new Path(inputTerms);
Path outputTermFile = new Path(outputTerm);

JobConf conf = new JobConf(ParseCorpus.class);
JobConf conf = new JobConf(getConf());
conf.setJarByClass(getClass());
FileSystem fs = FileSystem.get(conf);

sLogger.info("Tool: " + ParseCorpus.class.getSimpleName());
Expand Down Expand Up @@ -594,7 +597,8 @@ public Path indexDocument(String inputDocument, String outputDocument, String te
Path termIndexPath = new Path(termIndex);
Path titleIndexPath = new Path(titleIndex);

JobConf conf = new JobConf(ParseCorpus.class);
JobConf conf = new JobConf(getConf());
conf.setJarByClass(getClass());
FileSystem fs = FileSystem.get(conf);

sLogger.info("Tool: " + ParseCorpus.class.getSimpleName());
Expand Down Expand Up @@ -672,7 +676,7 @@ public static Map<String, Integer> importParameter(SequenceFile.Reader sequenceF
}

public static void main(String[] args) throws Exception {
int res = ToolRunner.run(new Configuration(), new ParseCorpus(), args);
int res = ToolRunner.run(new ParseCorpus(), args);
System.exit(res);
}

Expand Down
8 changes: 5 additions & 3 deletions src/main/java/cc/mrlda/VariationalInference.java
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ private int run(String inputPath, String outputPath, int numberOfTopics, int num
sLogger.info(" - truncation beta: " + truncateBeta);
sLogger.info(" - informed prior: " + informedPrior);

JobConf conf = new JobConf(VariationalInference.class);
JobConf conf = new JobConf(getConf());
conf.setJarByClass(getClass());
FileSystem fs = FileSystem.get(conf);

// delete the overall output path
Expand Down Expand Up @@ -387,7 +388,8 @@ private int run(String inputPath, String outputPath, int numberOfTopics, int num
int numberOfDocuments = 0;

do {
conf = new JobConf(VariationalInference.class);
conf = new JobConf(getConf());
conf.setJarByClass(getClass());
if (training) {
conf.setJobName(VariationalInference.class.getSimpleName() + " - Iteration "
+ (iterationCount + 1));
Expand Down Expand Up @@ -763,7 +765,7 @@ public static void exportAlpha(SequenceFile.Writer sequenceFileWriter, double[]
}

public static void main(String[] args) throws Exception {
int res = ToolRunner.run(new Configuration(), new VariationalInference(), args);
int res = ToolRunner.run(new VariationalInference(), args);
System.exit(res);
}
}