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


Java Maths.tanh方法代码示例

本文整理汇总了Java中cc.mallet.util.Maths.tanh方法的典型用法代码示例。如果您正苦于以下问题:Java Maths.tanh方法的具体用法?Java Maths.tanh怎么用?Java Maths.tanh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cc.mallet.util.Maths的用法示例。


在下文中一共展示了Maths.tanh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: plusEqualsHyperbolicPriorGradient

import cc.mallet.util.Maths; //导入方法依赖的package包/类
public void plusEqualsHyperbolicPriorGradient (Factors other, double slope, double sharpness) {
	// TODO This method could use some careful checking over, especially for flipped negations
	assert (initialWeights.length == finalWeights.length);
	double ss = slope * sharpness;
	for (int i = 0; i < initialWeights.length; i++) {
		// gsc: checking initial/final weights of crf.parameters as well since we could
      // have a state machine where some states have infinite initial and/or final weight
		if (!Double.isInfinite(initialWeights[i]) && !Double.isInfinite(other.initialWeights[i]))
        initialWeights[i] += ss * Maths.tanh (-other.initialWeights[i]);
		if (!Double.isInfinite(finalWeights[i]) && !Double.isInfinite(other.finalWeights[i]))
        finalWeights[i] += ss * Maths.tanh (-other.finalWeights[i]);
	}
	double w, ow;
	for (int i = 0; i < weights.length; i++) {
		if (weightsFrozen[i]) continue;
		// TODO Note that there doesn't seem to be a way to freeze the initialWeights and finalWeights 
		// TODO Should we also obey FeatureSelection here?  No need; it is enforced by the creation of the weights.
		if (!Double.isInfinite(defaultWeights[i])) defaultWeights[i] += ss * Maths.tanh(-other.defaultWeights[i]);
		for (int j = 0; j < weights[i].numLocations(); j++) {
			w = weights[i].valueAtLocation (j);
			ow = other.weights[i].valueAtLocation (j);
			if (!Double.isInfinite(w)) weights[i].setValueAtLocation(j, w + (ss * Maths.tanh(-ow)));
		}
	}
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:26,代码来源:CRF.java


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