m_Tree.reducedErrorPrune(); m_Tree.backfitHoldOutSet();
m_Tree.reducedErrorPrune(); m_Tree.backfitHoldOutSet();
/** * Prunes the tree using the hold-out data (bottom-up). * * @return the error * @throws Exception if pruning fails for some reason */ protected double reducedErrorPrune() throws Exception { // Is node leaf ? if (m_Attribute == -1) { return m_HoldOutError; } // Prune all sub trees double errorTree = 0; for (Tree m_Successor : m_Successors) { errorTree += m_Successor.reducedErrorPrune(); } // Replace sub tree with leaf if error doesn't get worse if (errorTree >= m_HoldOutError) { m_Attribute = -1; m_Successors = null; return m_HoldOutError; } else { return errorTree; } }
/** * Prunes the tree using the hold-out data (bottom-up). * * @return the error * @throws Exception if pruning fails for some reason */ protected double reducedErrorPrune() throws Exception { // Is node leaf ? if (m_Attribute == -1) { return m_HoldOutError; } // Prune all sub trees double errorTree = 0; for (Tree m_Successor : m_Successors) { errorTree += m_Successor.reducedErrorPrune(); } // Replace sub tree with leaf if error doesn't get worse if (errorTree >= m_HoldOutError) { m_Attribute = -1; m_Successors = null; return m_HoldOutError; } else { return errorTree; } }