@Override public void run() { for (int i = 0; i < numDocTopicIters; i++) { // synchronous read-only call: readModel.trainDocTopicModel(document, docTopics, docTopicModel); } if (writeModel != null) { // parallel call which is read-only on the docTopicModel, and write-only on the writeModel // this method does not return until all rows of the docTopicModel have been submitted // to write work queues writeModel.update(docTopicModel); } }
@Override public void run() { for (int i = 0; i < numDocTopicIters; i++) { // synchronous read-only call: readModel.trainDocTopicModel(document, docTopics, docTopicModel); } if (writeModel != null) { // parallel call which is read-only on the docTopicModel, and write-only on the writeModel // this method does not return until all rows of the docTopicModel have been submitted // to write work queues writeModel.update(docTopicModel); } }
@Override public void run() { for (int i = 0; i < numDocTopicIters; i++) { // synchronous read-only call: readModel.trainDocTopicModel(document, docTopics, docTopicModel); } if (writeModel != null) { // parallel call which is read-only on the docTopicModel, and write-only on the writeModel // this method does not return until all rows of the docTopicModel have been submitted // to write work queues writeModel.update(docTopicModel); } }
@Override public void map(IntWritable docId, VectorWritable doc, Context context) throws IOException, InterruptedException { int numTopics = getNumTopics(); Vector docTopics = new DenseVector(numTopics).assign(1.0 / numTopics); Matrix docModel = new SparseRowMatrix(numTopics, doc.get().size()); int maxIters = getMaxIters(); ModelTrainer modelTrainer = getModelTrainer(); for (int i = 0; i < maxIters; i++) { modelTrainer.getReadModel().trainDocTopicModel(doc.get(), docTopics, docModel); } topics.set(docTopics); context.write(docId, topics); }
@Override public void map(IntWritable docId, VectorWritable doc, Context context) throws IOException, InterruptedException { int numTopics = getNumTopics(); Vector docTopics = new DenseVector(numTopics).assign(1.0 / numTopics); Matrix docModel = new SparseRowMatrix(numTopics, doc.get().size()); int maxIters = getMaxIters(); ModelTrainer modelTrainer = getModelTrainer(); for (int i = 0; i < maxIters; i++) { modelTrainer.getReadModel().trainDocTopicModel(doc.get(), docTopics, docModel); } topics.set(docTopics); context.write(docId, topics); }
@Override public void map(IntWritable docId, VectorWritable doc, Context context) throws IOException, InterruptedException { int numTopics = getNumTopics(); Vector docTopics = new DenseVector(numTopics).assign(1.0 / numTopics); Matrix docModel = new SparseRowMatrix(numTopics, doc.get().size()); int maxIters = getMaxIters(); ModelTrainer modelTrainer = getModelTrainer(); for (int i = 0; i < maxIters; i++) { modelTrainer.getReadModel().trainDocTopicModel(doc.get(), docTopics, docModel); } topics.set(docTopics); context.write(docId, topics); }