当前位置: 首页>>代码示例>>Java>>正文


Java ParallelTopicModel.addInstances方法代码示例

本文整理汇总了Java中cc.mallet.topics.ParallelTopicModel.addInstances方法的典型用法代码示例。如果您正苦于以下问题:Java ParallelTopicModel.addInstances方法的具体用法?Java ParallelTopicModel.addInstances怎么用?Java ParallelTopicModel.addInstances使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cc.mallet.topics.ParallelTopicModel的用法示例。


在下文中一共展示了ParallelTopicModel.addInstances方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: predictValuesProbs

import cc.mallet.topics.ParallelTopicModel; //导入方法依赖的package包/类
public void predictValuesProbs(boolean topicCreation) {
	ParallelTopicModel LDA = new ParallelTopicModel(this.numTopics, ALPHA * this.numTopics, BETA); // TODO
	LDA.addInstances(this.instances);
	LDA.setNumThreads(1);
	LDA.setNumIterations(NUM_ITERATIONS);
	LDA.setRandomSeed(43);
	try {
		LDA.estimate();
	} catch (Exception e) {
		e.printStackTrace();
	}
	this.docList = getMaxTopicsByDocs(LDA, this.numTopics);
	System.out.println("Fetched Doc-List");
	this.topicList = !topicCreation ? getMaxTermsByTopics(LDA, MAX_TERMS) : null;
	System.out.println("Fetched Topic-List");
}
 
开发者ID:learning-layers,项目名称:TagRec,代码行数:17,代码来源:MalletCalculator.java

示例2: predictValuesProbs

import cc.mallet.topics.ParallelTopicModel; //导入方法依赖的package包/类
/**
 * What does this boolean value signify.
 * @param topicCreation
 */
public void predictValuesProbs(boolean topicCreation) {
    
    ParallelTopicModel LDA = new ParallelTopicModel(this.numTopics, ALPHA * this.numTopics, BETA); // TODO
    LDA.addInstances(this.instances);
    LDA.setNumThreads(1);
    LDA.setNumIterations(NUM_ITERATIONS);
    LDA.setRandomSeed(43);
    try {
        LDA.estimate();
    } catch (Exception e) {
        e.printStackTrace();
    }
    this.docList = getMaxTopicsByDocs(LDA, this.numTopics);
    System.out.println("Fetched Doc-List");
    this.topicList = !topicCreation ? getMaxTermsByTopics(LDA, MAX_TERMS) : null;
    System.out.println("Fetched Topic-List");
}
 
开发者ID:learning-layers,项目名称:TagRec,代码行数:22,代码来源:MalletCalculatorTweet.java

示例3: predictValuesProbs

import cc.mallet.topics.ParallelTopicModel; //导入方法依赖的package包/类
public void predictValuesProbs() {
	ParallelTopicModel LDA = new ParallelTopicModel(this.numTopics, ALPHA * this.numTopics, BETA); // TODO
	LDA.addInstances(this.instances);
	LDA.setNumThreads(1);
	LDA.setNumIterations(NUM_ITERATIONS);
	LDA.setRandomSeed(43);
	try {
		LDA.estimate();
	} catch (Exception e) {
		e.printStackTrace();
	}
	this.docList = getMaxTopicsByDocs(LDA, this.numTopics);
	System.out.println("Fetched Doc-List");
	this.topicList = getMaxTermsByTopics(LDA, MAX_TERMS);
	System.out.println("Fetched Topic-List");
}
 
开发者ID:domkowald,项目名称:tagrecommender,代码行数:17,代码来源:MalletCalculator.java

示例4: createLDAModel

import cc.mallet.topics.ParallelTopicModel; //导入方法依赖的package包/类
/**
 * Creates the LDA model on the specified document corpus
 * @param texts a list of documents
 * @param numTopics the number of desired documents
 * @param numIterations the number of LDA iterationss
 * @return An LDA topic model
 * @throws IOException
 */
private ParallelTopicModel createLDAModel(List<String> texts, int numTopics, int numIterations) throws IOException
{
	InstanceList instanceList = createInstanceList(texts);
	ParallelTopicModel model = new ParallelTopicModel(numTopics);
	model.addInstances(instanceList);
	model.setNumIterations(numIterations);
	model.estimate();
	return model;
}
 
开发者ID:socialsensor,项目名称:topic-detection,代码行数:18,代码来源:LDA.java

示例5: createNewModel

import cc.mallet.topics.ParallelTopicModel; //导入方法依赖的package包/类
private ParallelTopicModel createNewModel() throws IOException {

		InstanceList instanceList = createInstanceList(textList);
		//int numTopics = instanceList.size() / 2;
		ParallelTopicModel model = new ParallelTopicModel(numTopics);
		System.out.println(" NUMBER OF TOPICS "+numTopics);
		model.addInstances(instanceList);
		
		
		//model.beta = this.beta;
		model.setNumIterations(this.numIterations);
		model.setOptimizeInterval(this.optimizeInterval);
		model.setNumThreads(4);
		if (loggingHandler!=null) model.logger.addHandler(loggingHandler);
		
		model.estimate();
		
		
		System.out.println("Model log likelihood: " + model.modelLogLikelihood());	

		return model;
	}
 
开发者ID:HendrikStrobelt,项目名称:ditop_wrangler,代码行数:23,代码来源:MalletLDA.java

示例6: estimate

import cc.mallet.topics.ParallelTopicModel; //导入方法依赖的package包/类
/**
 * Estimate a topic model for collaborative filtering data.
 *
 * @param <U> user type
 * @param <I> item type
 * @param preferences preference data
 * @param k number of topics
 * @param alpha alpha in model
 * @param beta beta in model
 * @param numIterations number of iterations
 * @param burninPeriod burnin period
 * @return a topic model
 * @throws IOException when internal IO error occurs
 */
public static <U, I> ParallelTopicModel estimate(FastPreferenceData<U, I> preferences, int k, double alpha, double beta, int numIterations, int burninPeriod) throws IOException {
    
    ParallelTopicModel topicModel = new ParallelTopicModel(k, alpha * k, beta);
    topicModel.addInstances(new LDAInstanceList<>(preferences));
    topicModel.setTopicDisplay(numIterations + 1, 0);
    topicModel.setNumIterations(numIterations);
    topicModel.setBurninPeriod(burninPeriod);
    topicModel.setNumThreads(Runtime.getRuntime().availableProcessors());

    topicModel.estimate();

    return topicModel;
}
 
开发者ID:RankSys,项目名称:RankSys,代码行数:28,代码来源:LDAModelEstimator.java


注:本文中的cc.mallet.topics.ParallelTopicModel.addInstances方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。