本文整理汇总了C++中Accumulator::accumulateObservation方法的典型用法代码示例。如果您正苦于以下问题:C++ Accumulator::accumulateObservation方法的具体用法?C++ Accumulator::accumulateObservation怎么用?C++ Accumulator::accumulateObservation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Accumulator
的用法示例。
在下文中一共展示了Accumulator::accumulateObservation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: accumulate
// accumulate statistics
void DTAccumulator::accumulate(Alignment *alignment, MatrixBase<float> &mFeatures, bool bNumerator) {
Accumulator *accumulator = NULL;
double dOccupationTotal = 0.0;
for(unsigned int t=0 ; t < alignment->getFrames() ; ++t) {
FrameAlignment *frameAlignment = alignment->getFrameAlignment(t);
VectorStatic<float> vFeatureVector = mFeatures.getRow(t);
for(FrameAlignment::iterator it = frameAlignment->begin() ; it != frameAlignment->end() ; ++it) {
double dOccupationNum = (*it)->dOccupation;
HMMState *hmmState = m_hmmManager->getHMMState((*it)->iHMMState);
// get Gaussian occupation from the mixture occupation
// (1) compute the mixture likelihood (all Gaussian components)
double dLikelihoodTotal = -DBL_MAX;
int iGaussianComponents = hmmState->getMixture().getNumberComponents();
double *dLikelihoodGaussian = new double[iGaussianComponents];
for(int iGaussian = 0 ; iGaussian < iGaussianComponents ; ++iGaussian) {
dLikelihoodGaussian[iGaussian] = hmmState->computeEmissionProbabilityGaussian(iGaussian,
mFeatures.getRow(t).getData(),-1);
dLikelihoodGaussian[iGaussian] += log(hmmState->getMixture()(iGaussian)->weight());
dLikelihoodTotal = Numeric::logAddition(dLikelihoodTotal,dLikelihoodGaussian[iGaussian]);
}
// (2) accumulate statistics for each mixture component
for(int iGaussian = 0 ; iGaussian < iGaussianComponents ; ++iGaussian) {
double dProbGaussian = exp(dLikelihoodGaussian[iGaussian]-dLikelihoodTotal);
assert(dProbGaussian >= 0.0);
double dOccupationGaussian = dOccupationNum*dProbGaussian;
unsigned int iKey = Accumulator::getPhysicalAccumulatorKey(hmmState->getId(),iGaussian);
if (bNumerator) {
accumulator = m_mAccumulatorNum[iKey];
} else {
accumulator = m_mAccumulatorDen[iKey];
}
accumulator->accumulateObservation(vFeatureVector,dOccupationGaussian);
dOccupationTotal += dOccupationGaussian;
}
delete [] dLikelihoodGaussian;
}
}
printf("accumulated: %12.6f\n",dOccupationTotal);
}