throw new IllegalArgumentException ("--input-model not supported with --use-pam.");
PAM4L pam = new PAM4L(pamNumSupertopics.value, pamNumSubtopics.value);
pam.estimate (ilist, numIterations.value, /*optimizeModelInterval*/50,
showTopicsInterval.value,
outputModelInterval.value, outputModelFilename.value,
randomSeed.value == 0 ? new Randoms() : new Randoms(randomSeed.value));
pam.printTopWords(topWords.value, true);
if (stateFile.value != null)
pam.printState (new File(stateFile.value));
if (docTopicsFile.value != null) {
PrintWriter out = new PrintWriter (new FileWriter ((new File(docTopicsFile.value))));
pam.printDocumentTopics (out, docTopicsThreshold.value, docTopicsMax.value);
out.close();
}
if (outputModelFilename.value != null) {
assert (pam != null);
try {
ObjectOutputStream oos = new ObjectOutputStream (new FileOutputStream (outputModelFilename.value));
oos.writeObject (pam);
oos.close();
} catch (Exception e) {
e.printStackTrace();
throw new IllegalArgumentException ("Couldn't write topic model to filename "+outputModelFilename.value);
}
}
}
else if (useNgrams.value) {
InstanceList ilist = InstanceList.load (new File(inputFile.value));
System.out.println ("Data loaded.");
if (inputModelFilename.value != null)
throw new IllegalArgumentException ("--input-model not supported with --use-ngrams.");
TopicalNGrams tng = new TopicalNGrams(numTopics.value,
alpha.value,
beta.value,
gamma.value,
delta.value,
delta1.value,
delta2.value);
tng.estimate (ilist, numIterations.value, showTopicsInterval.value,
outputModelInterval.value, outputModelFilename.value,
randomSeed.value == 0 ? new Randoms() : new Randoms(randomSeed.value));
tng.printTopWords(topWords.value, true);
if (stateFile.value != null)
tng.printState (new File(stateFile.value));
if (docTopicsFile.value != null) {
PrintWriter out = new PrintWriter (new FileWriter ((new File(docTopicsFile.value))));