本文整理汇总了Java中cc.mallet.grmm.util.Flops.sumLogProb方法的典型用法代码示例。如果您正苦于以下问题:Java Flops.sumLogProb方法的具体用法?Java Flops.sumLogProb怎么用?Java Flops.sumLogProb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cc.mallet.grmm.util.Flops
的用法示例。
在下文中一共展示了Flops.sumLogProb方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: marginalizeInternal
import cc.mallet.grmm.util.Flops; //导入方法依赖的package包/类
protected Factor marginalizeInternal (AbstractTableFactor result)
{
result.setAll (Double.NEGATIVE_INFINITY);
int[] projection = largeIdxToSmall (result);
/* Add each element of the single array of the large potential
to the correct element in the small potential. */
int numLocs = probs.numLocations ();
for (int largeLoc = 0; largeLoc < numLocs; largeLoc++) {
/* Convert a single-index from this distribution to
one for the smaller distribution */
int smallIdx = projection[largeLoc];
/* Whew! Now, add it in. */
double oldValue = this.probs.valueAtLocation (largeLoc);
double currentValue = result.probs.singleValue (smallIdx);
result.probs.setValueAtLocation (smallIdx,
Maths.sumLogProb (oldValue, currentValue));
}
Flops.sumLogProb (numLocs);
return result;
}
示例2: logspaceOneNorm
import cc.mallet.grmm.util.Flops; //导入方法依赖的package包/类
private double logspaceOneNorm ()
{
double sum = Double.NEGATIVE_INFINITY; // That's 0 in log space
for (int i = 0; i < probs.numLocations (); i++) {
sum = Maths.sumLogProb (sum, probs.valueAtLocation (i));
}
Flops.sumLogProb (probs.numLocations ());
return sum;
}
示例3: plusEqualsInternal
import cc.mallet.grmm.util.Flops; //导入方法依赖的package包/类
/**
* Does the conceptual equivalent of this += pot.
* Assumes that pot's variables are a subset of
* this potential's.
*/
protected void plusEqualsInternal (DiscreteFactor ptl)
{
int[] projection = largeIdxToSmall (ptl);
int numLocs = probs.numLocations ();
for (int singleLoc = 0; singleLoc < numLocs; singleLoc++) {
int smallIdx = projection[singleLoc];
double prev = this.probs.valueAtLocation (singleLoc);
double newVal = ptl.logValue (smallIdx);
double product = Maths.sumLogProb (prev, newVal);
this.probs.setValueAtLocation (singleLoc, product);
}
Flops.sumLogProb (numLocs);
}
示例4: plusEqualsAtLocation
import cc.mallet.grmm.util.Flops; //导入方法依赖的package包/类
protected void plusEqualsAtLocation (int loc, double v)
{
Flops.log (); Flops.sumLogProb (1);
double oldVal = logValue (loc);
setRawValue (loc, Maths.sumLogProb (oldVal, Math.log (v)));
}