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


Java Transducer.IMPOSSIBLE_WEIGHT属性代码示例

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


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

示例1: call

public Double call() throws Exception {
	double value = 0;
	
	for (int ii = start; ii < end; ii++) {
		Instance inst = trainingSet.get(ii);
		Sequence input = (Sequence) inst.getData();
		double initProbs[] = initialProbList.get(ii);
		double finalProbs[] = finalProbList.get(ii);
		double transProbs[][][] = transitionProbList.get(ii);

     double[][][] cachedDots = new double[input.size()][crf.numStates()][crf.numStates()];
     for (int j = 0; j < input.size(); j++) {
       for (int k = 0; k < crf.numStates(); k++) {
         for (int l = 0; l < crf.numStates(); l++) {
           cachedDots[j][k][l] = Transducer.IMPOSSIBLE_WEIGHT;
         }
       }
     }
		
		double labeledWeight = new SumLatticeKL(crf, input, initProbs, 
		    finalProbs, transProbs, cachedDots, null).getTotalWeight();
		value += labeledWeight;

		//double unlabeledWeight = new SumLatticeDefault(crf, input, 
		//    expectationsCopy.new Incrementor()).getTotalWeight();
      double unlabeledWeight = new SumLatticeDefaultCachedDot(crf, input, null, 
          cachedDots, expectationsCopy.new Incrementor(), false, null).getTotalWeight();

		value -= unlabeledWeight;
	}
	return value;
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:32,代码来源:CRFOptimizableByKL.java

示例2: CachedDotTransitionIterator

protected CachedDotTransitionIterator(State source, Object fv,
    String output, double[] dots) {
  this.source = source;
  this.input = fv;
  this.weights = new double[source.numDestinations()];
  for (int i = 0; i < source.numDestinations(); i++) {
    weights[i] = dots[source.getDestinationState(i).getIndex()];
  }
  // Prepare nextIndex, pointing at the next non-impossible transition
  nextIndex = 0;
  while (nextIndex < source.numDestinations()
      && weights[nextIndex] == Transducer.IMPOSSIBLE_WEIGHT)
    nextIndex++;
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:14,代码来源:CachedDotTransitionIterator.java

示例3: nextState

public Transducer.State nextState() {
  assert (nextIndex < source.numDestinations());
  index = nextIndex;
  nextIndex++;
  while (nextIndex < source.numDestinations()
      && weights[nextIndex] == Transducer.IMPOSSIBLE_WEIGHT)
    nextIndex++;
  return source.getDestinationState(index);
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:9,代码来源:CachedDotTransitionIterator.java

示例4: LatticeNode

public LatticeNode() {
  alpha = new LogNumber[numStates];
  beta = new LogNumber[numStates];
  for (int si = 0; si < numStates; ++si) {
    alpha[si] = new LogNumber(Transducer.IMPOSSIBLE_WEIGHT,true);
    beta[si] =  new LogNumber(Transducer.IMPOSSIBLE_WEIGHT,true);
  }
}
 
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:8,代码来源:GELattice.java


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