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


Java ObservationInteger类代码示例

本文整理汇总了Java中be.ac.ulg.montefiore.run.jahmm.ObservationInteger的典型用法代码示例。如果您正苦于以下问题:Java ObservationInteger类的具体用法?Java ObservationInteger怎么用?Java ObservationInteger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObservationInteger类属于be.ac.ulg.montefiore.run.jahmm包,在下文中一共展示了ObservationInteger类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: write

import be.ac.ulg.montefiore.run.jahmm.ObservationInteger; //导入依赖的package包/类
public void write(Writer writer, OpdfInteger opdf)
throws IOException
{
	String s = "IntegerOPDF [";
	
	for (int i = 0; i < opdf.nbEntries(); i++)
		s += opdf.probability(new ObservationInteger(i)) + " ";
		
	writer.write(s + "]\n");
}
 
开发者ID:tanjiti,项目名称:jahmm,代码行数:11,代码来源:OpdfIntegerWriter.java

示例2: learn

import be.ac.ulg.montefiore.run.jahmm.ObservationInteger; //导入依赖的package包/类
public Hmm<ObservationVector> learn(List<ObservationVector> trainingObservations, List<ObservationInteger> trainingStates) {
	this.trainingObservations = trainingObservations;
	this.trainingStates = trainingStates;

	initCounters();
	generateCountsFromTraining();
	calculateHmmParams();

	Hmm<ObservationVector> hmm = new Hmm<ObservationVector>(pi, a, 
			generateOpdfVectors());
	return hmm;
}
 
开发者ID:claudiotrindade,项目名称:contexttoolkit,代码行数:13,代码来源:HmmSupervisedLearner.java

示例3: generateCountsFromTraining

import be.ac.ulg.montefiore.run.jahmm.ObservationInteger; //导入依赖的package包/类
/**
 * Prepares the counts from training data before calculating the HMM parameters
 */
public void generateCountsFromTraining() {
	// iterate through observations together with states
	int prevState = -1;
	for (int obs = 0; obs < NUM_OBSERVATIONS; obs++) {
		// count states and state transitions
		ObservationInteger stateObj = trainingStates.get(obs); // state(t)
		int state = stateObj.value;
		if (obs == 0) {
			prevState = state;
		}
		N_STATE_TO_STATE[prevState][state]++; // increment count for transition from prevState to state
		N_STATE[state]++; // increment count for this state; do for all t

		// count emissions of state to observation
		ObservationVector observation = trainingObservations.get(obs);
		double[] observationVal = observation.values(); // vector of form e.g.: [0 0 1 1 0 1 0 ...]

		//			DoubleArrayWrapper observationValWrapper = new DoubleArrayWrapper(observationVal);
		//			Map<DoubleArrayWrapper, Integer> n_state_to_obs =  N_STATE_TO_OBS[state];
		//			Integer origCount = n_state_to_obs.get(observationValWrapper);
		//			if (origCount == null) { origCount = 0; }
		//			n_state_to_obs.put(observationValWrapper, origCount + 1); // increment emission count for this observation vector


		N_STATE_TO_OBS[state][OpdfVector.getIntegerEquivalent(observationVal, NUM_OBSERVATION_VALS)]++; // increment emission count for this observation
		// iterate through features to see which is activated
		for (int f = 0; f < observationVal.length; f++) {
			if (observationVal[f] == 1) {
				N_STATE_TO_ATTR[state][f]++;
			}
		}			

		// update prevState to current state
		prevState = state; 				
	}
}
 
开发者ID:claudiotrindade,项目名称:contexttoolkit,代码行数:40,代码来源:HmmSupervisedLearner.java

示例4: write

import be.ac.ulg.montefiore.run.jahmm.ObservationInteger; //导入依赖的package包/类
public void write(ObservationInteger observation, Writer writer) 
throws IOException
{
	writer.write(observation.value + "; ");
}
 
开发者ID:tanjiti,项目名称:jahmm,代码行数:6,代码来源:ObservationIntegerWriter.java


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