public void testNB(String trainingSet, String testSet, String userId) throws Exception{
		if(trainingSet == "" || testSet == "" || userId == "")
			return;
		java.util.Date date= new java.util.Date();
		
		//System.out.println("[Final Classification]["+new Timestamp(date.getTime())+"] Training set: " + trainingSet + " | Test set: " + testSet + " | User ID: " + userId);
		
		CSVLoader loader = new CSVLoader();

		double[] pred_val;
		int pos = 0,neg = 0;
		String final_prediction="";
		Writer writer = null;
		File outputFile = null;
		
		NaiveBayes nb = new NaiveBayes();
		J48 dt = new J48();
		RandomForest rf = new RandomForest();
		
		// Training Classifier.
		S3Object object = s3.getObject(new GetObjectRequest(bucketName, trainingSet));      
		File trainSet = createFile(object.getObjectContent());	
		loader.setSource(trainSet);	    
		Instances train = loader.getDataSet();
		train.setClassIndex(train.numAttributes() - 1);
		
		// Remove user-id from feature-set.
		String[] options = new String[2];
		options[0] = "-R";
		options[1] = "1";
		Remove remove = new Remove();
		remove.setOptions(options);
		remove.setInputFormat(train);
		Instances newTrain = Filter.useFilter(train, remove);
		newTrain.setClassIndex(newTrain.numAttributes() - 1);
		System.out.println("["+new Timestamp(date.getTime())+"] Reading training set completed.");
		
		nb.buildClassifier(newTrain);
		System.out.println("["+new Timestamp(date.getTime())+"] Training Naive Bayes completed.");
		dt.buildClassifier(newTrain);
		System.out.println("["+new Timestamp(date.getTime())+"] Training Decision Tree completed.");
		rf.buildClassifier(newTrain);
		System.out.println("["+new Timestamp(date.getTime())+"] Training RandomForest completed.");

		// Testing unlabeled data.
		object = s3.getObject(new GetObjectRequest(bucketName, testSet));    
		File testingSet = createFile(object.getObjectContent());	
		loader.setSource(testingSet);	 
		Instances test = loader.getDataSet();
		test.setClassIndex(test.numAttributes() - 1);
		
		Instances newTest = Filter.useFilter(test, remove);
		newTest.setClassIndex(newTest.numAttributes() - 1);
		
		//Instances newTest = Filter.useFilter(test, remove);
		System.out.println("["+new Timestamp(date.getTime())+"] Reading test set completed.");
		
		outputFile = File.createTempFile("recommend_"+userId, ".dat");
		outputFile.deleteOnExit();
		writer = new OutputStreamWriter(new FileOutputStream(outputFile));
		
		for (int i = 0; i < newTest.numInstances(); i++) {
			pos = 0;
			neg = 0;
			pred_val = new double[3];
			pred_val[0] = nb.classifyInstance(newTest.instance(i));
			pred_val[1] = dt.classifyInstance(newTest.instance(i));
			pred_val[2] = rf.classifyInstance(newTest.instance(i));
			
			for(int j = 0; j < 3; j++) {
				if((int) pred_val[j] == 0) {
					pos++;
				} else if((int) pred_val[j] == 1) {
					neg++;
				} else {
					neg--;
				}
			}
			
			final_prediction = pos > neg ? "positive" : "negative";
			
			if(final_prediction.equals("positive")) {
				writer.write(Integer.toString((int)newTest.instance(i).value(0)));
				writer.write("\n");
			}
		}
		
		writer.flush();
		writer.close();
		s3.putObject(new PutObjectRequest(bucketName, resultFolder + "/recommend_"+userId+".dat", outputFile));		
		System.out.println("["+new Timestamp(date.getTime())+"] Storing classification result completed.");
		
		outputFile = File.createTempFile("PredictionSummary_"+userId, ".dat");
		outputFile.deleteOnExit();
		writer = new OutputStreamWriter(new FileOutputStream(outputFile));
		
		Evaluation eval = new Evaluation(newTrain);
		
		System.out.println("["+new Timestamp(date.getTime())+"] Cross-validating Naive Bayes.");
		eval.crossValidateModel(nb, newTrain, 10, new Random(1));
		writer.write(eval.toSummaryString("\n Naive Bayes Result\n============================\n", true));
		
		System.out.println("["+new Timestamp(date.getTime())+"] Cross-validating Decision Tree.");
		eval.crossValidateModel(dt, newTrain, 10, new Random(1));
		writer.write(eval.toSummaryString("\n Decision Tree Result\n============================\n", true));
		
		System.out.println("["+new Timestamp(date.getTime())+"] Cross-validating Random Forest.");
		eval.crossValidateModel(rf, newTrain, 10, new Random(1));
		writer.write(eval.toSummaryString("\n Random Forest Result\n============================\n", true));
		
		writer.flush();
		writer.close();
		s3.putObject(new PutObjectRequest(bucketName, statFolder + "/PredictionSummary__"+userId+".dat", outputFile));
		
		System.out.println("["+new Timestamp(date.getTime())+"] Classification completed successfuly.");
	}