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; }
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; }
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; }