question: @ Override public void buildClassifier ( Instances data ) throws Exception { if ( m_fastRegression && ( m_fixedNumIterations < 0 ) ) { m_fixedNumIterations = tryLogistic ( data ) ; } Instances cvData = new Instances ( data ) ; cvData . stratify ( m_numFoldsPruning ) ; double [ ] [ ] alphas = new double [ m_numFoldsPruning ] [ ] ; double [ ] [ ] errors = new double [ m_numFoldsPruning ] [ ] ; for ( int i = 0 ; i < m_numFoldsPruning ; i ++ ) { Instances train = cvData . trainCV ( m_numFoldsPruning , i ) ; Instances test = cvData . testCV ( m_numFoldsPruning , i ) ; buildTree ( train , null , train . numInstances ( ) , 0 , null ) ; int numNodes = getNumInnerNodes ( ) ; alphas [ i ] = new double [ numNodes + 2 ] ; errors [ i ] = new double [ numNodes + 2 ] ; prune ( alphas [ i ] , errors [ i ] , test ) ; } cvData = null ; buildTree ( data , null , data . numInstances ( ) , 0 , null ) ; int numNodes = getNumInnerNodes ( ) ; double [ ] treeAlphas = new double [ numNodes + 2 ] ; int iterations = prune ( treeAlphas , null , null ) ; double [ ] treeErrors = new double [ numNodes + 2 ] ; for ( int i = 0 ; i <= iterations ; i ++ ) { double alpha = Math . sqrt ( treeAlphas [ i ] * treeAlphas [ i + 1 ] ) ; double error = 0 ; for ( int k = 0 ; k < m_numFoldsPruning ; k ++ ) { int l = 0 ; while ( alphas [ k ] [ l ] <= alpha ) { l ++ ; } error += errors [ k ] [ l - 1 ] ; } treeErrors [ i ] = error ; } int best = - 1 ; double bestError = Double . MAX_VALUE ; for ( int i = iterations ; i >= 0 ; i -- ) { if ( treeErrors [ i ] < bestError ) { bestError = treeErrors [ i ] ; best = i ; } } double bestAlpha = Math . sqrt ( treeAlphas [ best ] * treeAlphas [ best + 1 ] ) ; unprune ( ) ; prune ( bestAlpha ) ; }
target:  Method for building a logistic model tree (only called for the root node). Grows an initial logistic model tree and prunes it back using the CART pruning scheme.