return v;
}
private LDAState generateRandomState(int numWords, int numTopics) {
double topicSmoothing = 50.0 / numTopics; // whatever
Matrix m = new DenseMatrix(numTopics, numWords);
double[] logTotals = new double[numTopics];
for (int k = 0; k < numTopics; ++k) {
double total = 0.0; // total number of pseudo counts we made
for (int w = 0; w < numWords; ++w) {
// A small amount of random noise, minimized by having a floor.
double pseudocount = random.nextDouble() + 1.0E-10;
total += pseudocount;
m.setQuick(k, w, Math.log(pseudocount));
}
logTotals[k] = Math.log(total);
}