src/main/java/ch/uzh/ifi/seal/ase/cscc/RecommenderHelper.java
private float[] performCrossValidation(int bucketSize, int testBucketNum, CompletionModel completionModel) {
        List<String> zips = IoHelper.findAllZips(contextsDir);
        int zipTotal = getNumZips(zips);
        int zipCount = 0;
        int zipCountInBucket = 0;

        CompletionModelEvaluator eval = new CompletionModelEvaluator(completionModel);

        for (String zip : zips) {

            if (++zipCount > zipTotal) break;

            // if current zip is in the test bucket we use it for evaluation
            if (zipIsInTestBucket(zipCount, testBucketNum, bucketSize)) {

                if (CSCCConfiguration.PRINT_PROGRESS) {
                    zipCountInBucket++;
                    double perc = 100 * zipCountInBucket / (double) bucketSize;
                    System.out.printf("## %s, processing %s...\n(%d/%d, %.1f%% done)\n", new Date(), zip, zipCountInBucket, bucketSize,
                            perc);
                }

                try (IReadingArchive ra = new ReadingArchive(new File(zip))) {

                    while (ra.hasNext()) {

                        if (CSCCConfiguration.PRINT_PROGRESS_CONTEXTS) {
                            System.out.printf("."); // print '.' to indicate that a context is being processed
                        }

                        Context ctx = ra.getNext(Context.class);

                        ISST sst = ctx.getSST();

                        IndexDocumentExtractionVisitor indexDocumentExtractionVisitor = new IndexDocumentExtractionVisitor();
                        List<IndexDocument> indexDocuments = new LinkedList<>();

                        sst.accept(indexDocumentExtractionVisitor, indexDocuments);

                        for (IndexDocument document : indexDocuments) {
                            if (CSCCConfiguration.PRINT_PROGRESS_CONTEXTS) {
                                System.out.printf("'"); // print ' to indicate that an IndexDocument is being evaluated
                            }
                            eval.evaluate(document);
                        }
                    }
                    ra.close();
                    if (CSCCConfiguration.PRINT_PROGRESS_CONTEXTS) {
                        System.out.println();
                    }
                }
            }
        }

        float precision = eval.getPrecision();
        float recall = eval.getRecall();
        System.out.printf("precision = %.0f%%, recall = %.0f%%\n", precision, recall);

        return new float[]{precision, recall};
    }
/**
     * @param bucketSize
     * @param testBucketNum
     * @param completionModel
     * @return result of cross validation: index 0 contains precision, index 1 contains recall
     */
@param bucketSize
@param testBucketNum
@param completionModel
@return result of cross validation: index 0 contains precision, index 1 contains recall
@param bucketSize @param testBucketNum @param completionModel @return result of cross validation : index 0 contains precision index 1 contains recall
private float[] performCrossValidation(int bucketSize, int testBucketNum, CompletionModel completionModel) {
        List<String> zips = IoHelper.findAllZips(contextsDir);
        int zipTotal = getNumZips(zips);
        int zipCount = 0;
        int zipCountInBucket = 0;
        CompletionModelEvaluator eval = new CompletionModelEvaluator(completionModel);
        for (String zip : zips) {
            if (++zipCount > zipTotal) break;
            if (zipIsInTestBucket(zipCount, testBucketNum, bucketSize)) {
                if (CSCCConfiguration.PRINT_PROGRESS) {
                    zipCountInBucket++;
                    double perc = 100 * zipCountInBucket / (double) bucketSize;
                    System.out.printf("## %s, processing %s...\n(%d/%d, %.1f%% done)\n", new Date(), zip, zipCountInBucket, bucketSize,
                            perc);
                }
                try (IReadingArchive ra = new ReadingArchive(new File(zip))) {
                    while (ra.hasNext()) {
                        if (CSCCConfiguration.PRINT_PROGRESS_CONTEXTS) {
                            System.out.printf("."); 
                        }
                        Context ctx = ra.getNext(Context.class);
                        ISST sst = ctx.getSST();
                        IndexDocumentExtractionVisitor indexDocumentExtractionVisitor = new IndexDocumentExtractionVisitor();
                        List<IndexDocument> indexDocuments = new LinkedList<>();
                        sst.accept(indexDocumentExtractionVisitor, indexDocuments);
                        for (IndexDocument document : indexDocuments) {
                            if (CSCCConfiguration.PRINT_PROGRESS_CONTEXTS) {
                                System.out.printf("'"); 
                            }
                            eval.evaluate(document);
                        }
                    }
                    ra.close();
                    if (CSCCConfiguration.PRINT_PROGRESS_CONTEXTS) {
                        System.out.println();
                    }
                }
            }
        }
        float precision = eval.getPrecision();
        float recall = eval.getRecall();
        System.out.printf("precision = %.0f%%, recall = %.0f%%\n", precision, recall);
        return new float[]{precision, recall};
    }
private float [ ] performCrossValidation ( int bucketSize , int testBucketNum , CompletionModel completionModel ) { List < String > zips = IoHelper . findAllZips ( contextsDir ) ; int zipTotal = getNumZips ( zips ) ; int zipCount = 0 ; int zipCountInBucket = 0 ; CompletionModelEvaluator eval = new CompletionModelEvaluator ( completionModel ) ; for ( String zip : zips ) { if ( ++ zipCount > zipTotal ) break ; if ( zipIsInTestBucket ( zipCount , testBucketNum , bucketSize ) ) { if ( CSCCConfiguration . PRINT_PROGRESS ) { zipCountInBucket ++ ; double perc = 100 * zipCountInBucket / ( double ) bucketSize ; System . out . printf ( "## %s, processing %s...\n(%d/%d, %.1f%% done)\n" , new Date ( ) , zip , zipCountInBucket , bucketSize , perc ) ; } try ( IReadingArchive ra = new ReadingArchive ( new File ( zip ) ) ) { while ( ra . hasNext ( ) ) { if ( CSCCConfiguration . PRINT_PROGRESS_CONTEXTS ) { System . out . printf ( "." ) ; } Context ctx = ra . getNext ( Context . class ) ; ISST sst = ctx . getSST ( ) ; IndexDocumentExtractionVisitor indexDocumentExtractionVisitor = new IndexDocumentExtractionVisitor ( ) ; List < IndexDocument > indexDocuments = new LinkedList < > ( ) ; sst . accept ( indexDocumentExtractionVisitor , indexDocuments ) ; for ( IndexDocument document : indexDocuments ) { if ( CSCCConfiguration . PRINT_PROGRESS_CONTEXTS ) { System . out . printf ( "'" ) ; } eval . evaluate ( document ) ; } } ra . close ( ) ; if ( CSCCConfiguration . PRINT_PROGRESS_CONTEXTS ) { System . out . println ( ) ; } } } } float precision = eval . getPrecision ( ) ; float recall = eval . getRecall ( ) ; System . out . printf ( "precision = %.0f%%, recall = %.0f%%\n" , precision , recall ) ; return new float [ ] { precision , recall } ; }
@param bucketSize
 @param testBucketNum
 @param completionModel
 @return result of cross validation: index 0 contains precision, index 1 contains recall
@param bucketSize @param testBucketNum @param completionModel @return result of cross validation : index 0 contains precision index 1 contains recall
// if current zip is in the test bucket we use it for evaluation
 // print '.' to indicate that a context is being processed
 // print ' to indicate that an IndexDocument is being evaluated
