parameters: (tree, testExamples, appendExamples=0)
return_statement: return float(nBad) / nTest, badExamples
docstring: Determines the classification error for the testExamples
  
      **Arguments**
  
        - tree: a decision tree (or anything supporting a _ClassifyExample()_ method)
  
        - testExamples: a list of examples to be used for testing
  
        - appendExamples: a toggle which is passed along to the tree as it does
          the classification. The trees can use this to store the examples they
          classify locally.
  
      **Returns**
  
        a 2-tuple consisting of:
  
          1) the percent error of the tree
  
          2) a list of misclassified examples
docstring_summary: Determines the classification error for the testExamples
docstring_tokens: Determines the classification error for the testExamples
function: def CrossValidate(tree, testExamples, appendExamples=0):
    """ Determines the classification error for the testExamples
  
      **Arguments**
  
        - tree: a decision tree (or anything supporting a _ClassifyExample()_ method)
  
        - testExamples: a list of examples to be used for testing
  
        - appendExamples: a toggle which is passed along to the tree as it does
          the classification. The trees can use this to store the examples they
          classify locally.
  
      **Returns**
  
        a 2-tuple consisting of:
  
          1) the percent error of the tree
  
          2) a list of misclassified examples
  
    """
    nTest = len(testExamples)
    nBad = 0
    badExamples = []
    for i in range(nTest):
      testEx = testExamples[i]
      trueRes = testEx[-1]
      res = tree.ClassifyExample(testEx, appendExamples)
      if (trueRes != res).any():
        badExamples.append(testEx)
        nBad += 1
  
    return float(nBad) / nTest, badExamples
function_tokens: def CrossValidate ( tree , testExamples , appendExamples = 0 ) : nTest = len ( testExamples ) nBad = 0 badExamples = [ ] for i in range ( nTest ) : testEx = testExamples [ i ] trueRes = testEx [ - 1 ] res = tree . ClassifyExample ( testEx , appendExamples ) if ( trueRes != res ) . any ( ) : badExamples . append ( testEx ) nBad += 1 return float ( nBad ) / nTest , badExamples