	public static void main(String args[]) throws IOException, FileNotFoundException {
		if (args.length < 1) {
			System.out.println("Usage: Main <document_folder>"
					+ " [" + Config.PARAM_STOPWORD + "]"
					+ " [" + Config.PARAM_STOPWORDFILE + "]"
					+ " [" + Config.PARAM_STEMMING + "]"
					+ " [" + Config.PARAM_FOLDER + "]"
			);
			return;
		}
		initializeLogging();
		if (args.length >= 1) {
			initializeFlags(args);
		}
		initializeDataSet(docFolder);
		FrequencyMap totalMap = new FrequencyMap();
		Classifier classifier = new Classifier();
        ROCGraph graph = new ROCGraph();
		int run = 0;
        for (DocSet docSet : docSetList) {
            int totalSpamDocs = 0;
            int totalHamDocs = 0;
            for (DocSet documentSet : docSetList) { 
                totalMap.add(documentSet);
                totalSpamDocs += documentSet.getNumSpamDocs();
                totalHamDocs += documentSet.getNumHamDocs();
            }
			run++;
			FrequencyMap trainingMap = totalMap.subtract(docSet);
			int trainingSpamDocs = totalSpamDocs - docSet.getNumSpamDocs();
			int trainingHamDocs = totalHamDocs - docSet.getNumHamDocs();
			int totalTrainingDocs = trainingSpamDocs + trainingHamDocs;
			double spamProb = trainingSpamDocs / (double) totalTrainingDocs;
			double hamProb = 1 - spamProb;
			classifier.reset();
			classifier.classify(docSet, trainingMap, spamProb);
			int TP = classifier.getTruePositives();
			int FP = classifier.getFalsePositives();
			int TN = classifier.getTrueNegatives();
			int FN = classifier.getFalseNegatives();
			double precision = TP / ((double) TP + FP);
			double recall = TP / ((double) TP + FN);
			double fpRate = FP / ((double) FP + TN);
			double tpRate = recall;
			StringBuilder stats = new StringBuilder();
			stats.append("Run no. " + run + "\n");
			stats.append("Total training size: " + totalTrainingDocs + "\n");
			stats.append("Total spam documents: " + trainingSpamDocs + "\n");
			stats.append("Total ham documents: " + trainingHamDocs + "\n");
			stats.append("Prior probabilities:\n");
			stats.append("Spam - " + spamProb + "\n");
			stats.append("Ham - " + hamProb + "\n");
			stats.append("TP = " + TP + ", FN = " + FN + ", FP = " + FP + ", TN = " + TN  + "\n");
			stats.append("Precision = " + precision + ", Recall = " + recall + "\n");
			stats.append("====================================================================\n");
			logger.log(Config.LOG_LEVEL, stats.toString());
			System.out.println(stats);
			graph.addPoint(tpRate, fpRate);
		}
		graph.createROCGraph(chartFile + ".png");
	}

	public static void main(String args[]) throws IOException, FileNotFoundException {
		if (args.length < 1) {
			System.out.println("Usage: Main <document_folder>"
					+ " [" + Config.PARAM_STOPWORD + "]"
					+ " [" + Config.PARAM_STOPWORDFILE + "]"
					+ " [" + Config.PARAM_STEMMING + "]"
					+ " [" + Config.PARAM_FOLDER + "]"
			);
			return;
		}
		initializeLogging();
		if (args.length >= 1) {
			initializeFlags(args);
		}
		initializeDataSet(docFolder);
		FrequencyMap totalMap = new FrequencyMap();
		Classifier classifier = new Classifier();
		ROCGraph graph = new ROCGraph();
		int run = 0;
        for (DocSet docSet : docSetList) {
            int totalSpamDocs = 0;
            int totalHamDocs = 0;
            for (DocSet documentSet : docSetList) { 
                totalMap.add(documentSet);
                totalSpamDocs += documentSet.getNumSpamDocs();
                totalHamDocs += documentSet.getNumHamDocs();
            }
			run++;
			FrequencyMap trainingMap = totalMap.subtract(docSet);
			int trainingSpamDocs = totalSpamDocs - docSet.getNumSpamDocs();
			int trainingHamDocs = totalHamDocs - docSet.getNumHamDocs();
			int totalTrainingDocs = trainingSpamDocs + trainingHamDocs;
			double spamProb = trainingSpamDocs / (double) totalTrainingDocs;
			double hamProb = 1 - spamProb;
			classifier.reset();
			classifier.classify(docSet, trainingMap, spamProb);
			int TP = classifier.getTruePositives();
			int FP = classifier.getFalsePositives();
			int TN = classifier.getTrueNegatives();
			int FN = classifier.getFalseNegatives();
			double precision = TP / ((double) TP + FP);
			double recall = TP / ((double) TP + FN);
			double fpRate = FP / ((double) FP + TN);
			double tpRate = recall;
			StringBuilder stats = new StringBuilder();
			stats.append("Run no. " + run + "\n");
			stats.append("Total training size: " + totalTrainingDocs + "\n");
			stats.append("Total spam documents: " + trainingSpamDocs + "\n");
			stats.append("Total ham documents: " + trainingHamDocs + "\n");
			stats.append("Prior probabilities:\n");
			stats.append("Spam - " + spamProb + "\n");
			stats.append("Ham - " + hamProb + "\n");
			stats.append("TP = " + TP + ", FN = " + FN + ", FP = " + FP + ", TN = " + TN  + "\n");
			stats.append("Precision = " + precision + ", Recall = " + recall + "\n");
			stats.append("====================================================================\n");
			logger.log(Config.LOG_LEVEL, stats.toString());
			System.out.println(stats);
			graph.addPoint(tpRate, fpRate);
		}
		graph.createROCGraph(chartFile + ".png");
	}
