本文整理匯總了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 + "; ");
}