本文整理汇总了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");
}
示例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;
}
示例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;
}
}
示例4: write
import be.ac.ulg.montefiore.run.jahmm.ObservationInteger; //导入依赖的package包/类
public void write(ObservationInteger observation, Writer writer)
throws IOException
{
writer.write(observation.value + "; ");
}