本文整理汇总了Java中cc.mallet.types.GainRatio类的典型用法代码示例。如果您正苦于以下问题:Java GainRatio类的具体用法?Java GainRatio怎么用?Java GainRatio使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GainRatio类属于cc.mallet.types包,在下文中一共展示了GainRatio类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: computeCostAndPrune
import cc.mallet.types.GainRatio; //导入依赖的package包/类
public double computeCostAndPrune()
{
double costS = getMDL();
if (isLeaf())
return costS + 1;
double minCost1 = getLeftChild().computeCostAndPrune();
double minCost2 = getRightChild().computeCostAndPrune();
double costSplit = Math.log(m_gainRatio.getNumSplitPointsForBestFeature()) / GainRatio.log2;
double minCostN = Math.min(costS+1, costSplit+1+minCost1+minCost2);
if (Maths.almostEquals(minCostN, costS+1))
m_leftChild = m_rightChild = null;
return minCostN;
}
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:18,代码来源:C45.java
示例2: Node
import cc.mallet.types.GainRatio; //导入依赖的package包/类
public Node(InstanceList ilist, Node parent, int minNumInsts, int[] instIndices)
{
if (instIndices == null) {
instIndices = new int[ilist.size()];
for (int ii = 0; ii < instIndices.length; ii++)
instIndices[ii] = ii;
}
m_gainRatio = GainRatio.createGainRatio(ilist, instIndices, minNumInsts);
m_ilist = ilist;
m_instIndices = instIndices;
m_dataDict = m_ilist.getDataAlphabet();
m_minNumInsts = minNumInsts;
m_parent = parent;
m_leftChild = m_rightChild = null;
}
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:16,代码来源:C45.java
示例3: getMDL
import cc.mallet.types.GainRatio; //导入依赖的package包/类
/**
* Calculates the minimum description length of this node, i.e.,
* the length of the binary encoding that describes the feature
* and the split value used at this node
*/
public double getMDL()
{
int numClasses = m_ilist.getTargetAlphabet().size();
double mdl = getSize() * getGainRatio().getBaseEntropy();
mdl += ((numClasses-1) * Math.log(getSize() / 2.0)) / (2 * GainRatio.log2);
double piPow = Math.pow(Math.PI, numClasses/2.0);
double gammaVal = Maths.gamma(numClasses/2.0);
mdl += Math.log(piPow/gammaVal) / GainRatio.log2;
return mdl;
}
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:16,代码来源:C45.java
示例4: getGainRatio
import cc.mallet.types.GainRatio; //导入依赖的package包/类
public GainRatio getGainRatio() { return m_gainRatio; }
开发者ID:kostagiolasn,项目名称:NucleosomePatternClassifier,代码行数:2,代码来源:C45.java
注:本文中的cc.mallet.types.GainRatio类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论