@Override protected void cleanup(Context context) { getModelTrainer().stop(); } }
@Override protected void cleanup(Context context) { getModelTrainer().stop(); } }
@Override protected void cleanup(Context context) { getModelTrainer().stop(); } }
@Override protected void cleanup(Context context) throws IOException, InterruptedException { log.info("Stopping model trainer"); modelTrainer.stop(); log.info("Writing model"); TopicModel readFrom = modelTrainer.getReadModel(); for (MatrixSlice topic : readFrom) { context.write(new IntWritable(topic.index()), new VectorWritable(topic.vector())); } readModel.stop(); writeModel.stop(); } }
@Override protected void cleanup(Context context) throws IOException, InterruptedException { log.info("Stopping model trainer"); modelTrainer.stop(); log.info("Writing model"); TopicModel readFrom = modelTrainer.getReadModel(); for (MatrixSlice topic : readFrom) { context.write(new IntWritable(topic.index()), new VectorWritable(topic.vector())); } readModel.stop(); writeModel.stop(); } }
@Override protected void cleanup(Context context) throws IOException, InterruptedException { log.info("Stopping model trainer"); modelTrainer.stop(); log.info("Writing model"); TopicModel readFrom = modelTrainer.getReadModel(); for (MatrixSlice topic : readFrom) { context.write(new IntWritable(topic.index()), new VectorWritable(topic.vector())); } readModel.stop(); writeModel.stop(); } }
public void trainDocuments(double testFraction) { long start = System.nanoTime(); modelTrainer.start(); for (int docId = 0; docId < corpusWeights.numRows(); docId++) { if (testFraction == 0 || docId % (1 / testFraction) != 0) { Vector docTopics = new DenseVector(numTopics).assign(1.0 / numTopics); // docTopicCounts.getRow(docId) modelTrainer.trainSync(corpusWeights.viewRow(docId), docTopics , true, 10); } } modelTrainer.stop(); logTime("train documents", System.nanoTime() - start); }
public void trainDocuments(double testFraction) { long start = System.nanoTime(); modelTrainer.start(); for (int docId = 0; docId < corpusWeights.numRows(); docId++) { if (testFraction == 0 || docId % (1 / testFraction) != 0) { Vector docTopics = new DenseVector(numTopics).assign(1.0 / numTopics); // docTopicCounts.getRow(docId) modelTrainer.trainSync(corpusWeights.viewRow(docId), docTopics , true, 10); } } modelTrainer.stop(); logTime("train documents", System.nanoTime() - start); }
public void trainDocuments(double testFraction) { long start = System.nanoTime(); modelTrainer.start(); for (int docId = 0; docId < corpusWeights.numRows(); docId++) { if (testFraction == 0 || docId % (1 / testFraction) != 0) { Vector docTopics = new DenseVector(numTopics).assign(1.0 / numTopics); // docTopicCounts.getRow(docId) modelTrainer.trainSync(corpusWeights.viewRow(docId), docTopics , true, 10); } } modelTrainer.stop(); logTime("train documents", System.nanoTime() - start); }