public void prune(double alpha) throws Exception {
  Vector<LMTNode> nodeList;
  CompareNode comparator=new CompareNode();
  treeErrors();
  calculateAlphas();
  nodeList=getNodes();
  boolean prune=(nodeList.size() > 0);
  while (prune) {
    LMTNode nodeToPrune=Collections.min(nodeList,comparator);
    if (nodeToPrune.m_alpha > alpha) {
      break;
    }
    nodeToPrune.m_isLeaf=true;
    nodeToPrune.m_sons=null;
    treeErrors();
    calculateAlphas();
    nodeList=getNodes();
    prune=(nodeList.size() > 0);
  }
  for (  Object node : getNodes()) {
    LMTNode lnode=(LMTNode)node;
    if (!lnode.m_isLeaf) {
      m_regressions=null;
    }
  }
}

public void prune ( double alpha ) throws Exception { Vector < LMTNode > nodeList ; CompareNode comparator = new CompareNode ( ) ; treeErrors ( ) ; calculateAlphas ( ) ; nodeList = getNodes ( ) ; boolean prune = ( nodeList . size ( ) > 0 ) ; while ( prune ) { LMTNode nodeToPrune = Collections . min ( nodeList , comparator ) ; if ( nodeToPrune . m_alpha > alpha ) { break ; } nodeToPrune . m_isLeaf = true ; nodeToPrune . m_sons = null ; treeErrors ( ) ; calculateAlphas ( ) ; nodeList = getNodes ( ) ; prune = ( nodeList . size ( ) > 0 ) ; } for ( Object node : getNodes ( ) ) { LMTNode lnode = ( LMTNode ) node ; if ( ! lnode . m_isLeaf ) { m_regressions = null ; } } }
prunes a logistic model tree using the cart pruning scheme , given a cost - complexity parameter alpha .
