public LearningEvaluation evalModel (InstanceStream trainStream, InstanceStream testStream, AbstractClassifier model) {
        ClassificationPerformanceEvaluator evaluator = new BasicClassificationPerformanceEvaluator();
        evaluator.reset();
        long instancesProcessed = 0;
        System.out.println("Evaluating model...");
        trainModel(trainStream, model);
        while (testStream.hasMoreInstances()
                && ((MaxInstances < 0) || (instancesProcessed < MaxInstances))) {
            Instance testInst = (Instance) testStream.nextInstance().copy();
            int trueClass = (int) testInst.classValue();
            testInst.setClassMissing();
            double[] prediction = model.getVotesForInstance(testInst);
            evaluator.addClassificationAttempt(trueClass, prediction, testInst
                    .weight());
            instancesProcessed++;
            if (instancesProcessed % INSTANCES_BETWEEN_MONITOR_UPDATES == 0) {
                long estimatedRemainingInstances = testStream
                        .estimatedRemainingInstances();
                if (MaxInstances > 0) {
                    long maxRemaining = MaxInstances - instancesProcessed;
                    if ((estimatedRemainingInstances < 0)
                            || (maxRemaining < estimatedRemainingInstances)) {
                        estimatedRemainingInstances = maxRemaining;
                    }
                }
            }
        }
        return new LearningEvaluation(evaluator.getPerformanceMeasurements());
    }