human
Complete the below
def ensemble(nets):

    ''''Takes as input a list of nets, and then computes the accuracy on
    the test data when classifications are computed by taking a vote
    amongst the nets.  Returns a tuple containing a list of indices
    for test data which is erroneously classified, and a list of the
    corresponding erroneous predictions.
    Note that this is a quick-and-dirty kluge: it\'d be more reusable
    (and faster) to define a Theano function taking the vote.  But
    this works.'
    '''

=====
Give me a the Python program you requested?
assistant
#Here is the Python program you requested.
    (test_x, test_y) = test_data
    for net in nets:
        i = T.lscalar()
        net.test_mb_predictions = theano.function([i], net.layers[(-1)].y_out, givens={net.x: test_x[(i * net.mini_batch_size):((i + 1) * net.mini_batch_size)]})
        net.test_predictions = list(np.concatenate([net.test_mb_predictions(i) for i in xrange(1000)]))
    all_test_predictions = zip(*[net.test_predictions for net in nets])
    def plurality(p):
        return Counter(p).most_common(1)[0][0]
    plurality_test_predictions = [plurality(p) for p in all_test_predictions]
    test_y_eval = test_y.eval()
    error_locations = [j for j in xrange(10000) if (plurality_test_predictions[j] != test_y_eval[j])]
    erroneous_predictions = [plurality(all_test_predictions[j]) for j in error_locations]
    print 'Accuracy    is    {:.2%}'.format((1 - (len(error_locations) / 10000.0)))
    return (error_locations, erroneous_predictions)