public static void main(String[] args) throws Exception
	{
		Configuration conf = new Configuration();

		Job job = new Job(conf, "requestcounts");

		job.setOutputKeyClass(Text.class);
		job.setOutputValueClass(Text.class);

		job.setMapperClass(MapRequest.class);
		job.setReducerClass(ReduceRequest.class);

		job.setJarByClass(MapReduceNBTest.class);

		job.setInputFormatClass(TextInputFormat.class);
		job.setOutputFormatClass(TextOutputFormat.class);

		FileInputFormat.addInputPaths(job, args[0] + "," + args[1]); // test + model file
		FileOutputFormat.setOutputPath(job, new Path(args[2])); // model-requests file

		job.waitForCompletion(true);

		Job job1 = new Job(conf, "recordcounts");

		FileInputFormat.addInputPaths(job1, args[0] + "," + args[2]); // test + model-requests file
		FileOutputFormat.setOutputPath(job1, new Path(args[3])); // model-answer file

		job1.setOutputKeyClass(Text.class);
		job1.setOutputValueClass(Text.class);

		job1.setMapperClass(MapAnswers.class);
		job1.setReducerClass(ReduceAnswers.class);

		job1.setJarByClass(MapReduceNBTest.class);

		job1.setInputFormatClass(TextInputFormat.class);
		job1.setOutputFormatClass(TextOutputFormat.class);

		job1.waitForCompletion(true);

		Path path1 = new Path(args[6]); // cachedGlobalCounts
		Path path2 = new Path(args[7]); // cachedLabelCounts

		/*DistributedCache.addCacheFile(path1.toUri(), conf);
		DistributedCache.addCacheFile(path2.toUri(), conf);*/

		Configuration conf1 = new Configuration();
		String filename = "UNKNOWNFILE";

		try
		{
			filename = new Path(args[6]).toUri().toString();

			FileSystem fs = FileSystem.get(new Path(args[6]).toUri(), new Configuration());
			FileStatus[] status = fs.listStatus(new Path(args[6]));
			
			for (int i=0; i<status.length; i++)
			{
				if(status[i].getPath().toUri().toString().contains("part-r-") &&  !status[i].getPath().toUri().toString().contains("log") && !status[i].getPath().toUri().toString().contains("SUCCESS"))
				{
					System.out.println((status[i].getPath()).toUri());
					//DistributedCache.addCacheFile( (status[i].getPath()).toUri(), conf1);
					DistributedCache.addCacheFile( (status[i].getPath()).toUri(), conf1);
				}
			}

			filename = new Path(args[7]).toUri().toString();
			
			fs = FileSystem.get(new Path(args[7]).toUri(), new Configuration());
			FileStatus[] status1 = fs.listStatus(new Path(args[7]));
			
			for (int i=0;i<status1.length;i++)
			{
				if(status1[i].getPath().toUri().toString().contains("part-r-") &&  !status1[i].getPath().toUri().toString().contains("log") && !status1[i].getPath().toUri().toString().contains("SUCCESS"))
				{
					System.out.println((status1[i].getPath()).toUri());
					DistributedCache.addCacheFile( (status1[i].getPath()).toUri(), conf1);
					//DistributedCache.addCacheFile( (status1[i].getPath()).toUri(), job2.getConfiguration());
				}
			}
		}
		catch(Exception e)
		{
			System.out.println("File: " + filename + "not found");
		}

		Job job2 = new Job(conf1, "classifydocs");

		FileInputFormat.addInputPath(job2, new Path(args[3])); // model-answer file
		FileOutputFormat.setOutputPath(job2, new Path(args[4])); // output directory

		job2.setOutputKeyClass(Text.class);
		job2.setOutputValueClass(Text.class);

		job2.setMapperClass(MapClassify.class);
		job2.setReducerClass(ReduceClassify.class);

		job2.setJarByClass(MapReduceNBTest.class);

		job2.setInputFormatClass(TextInputFormat.class);
		job2.setOutputFormatClass(TextOutputFormat.class);

		job2.waitForCompletion(true);

		Job job3 = new Job(conf1, "accuracydocs");

		FileInputFormat.addInputPath(job3, new Path(args[4])); // output directory
		FileOutputFormat.setOutputPath(job3, new Path(args[5])); // output + accuracy file

		job3.setOutputKeyClass(Text.class);
		job3.setOutputValueClass(Text.class);

		job3.setMapperClass(MapAccuracy.class);
		job3.setReducerClass(ReduceAccuracy.class);

		job3.setJarByClass(MapReduceNBTest.class);

		job3.setInputFormatClass(TextInputFormat.class);
		job3.setOutputFormatClass(TextOutputFormat.class);

		job3.waitForCompletion(true);
		
		Job job4 = new Job(conf1, "accuracyfinal");

		FileInputFormat.addInputPath(job4, new Path(args[5])); // output + accuracy file
		FileOutputFormat.setOutputPath(job4, new Path(args[8])); // final accuracy file

		job4.setOutputKeyClass(Text.class);
		job4.setOutputValueClass(Text.class);

		job4.setMapperClass(MapFinalAccuracy.class);
		job4.setReducerClass(ReduceAccuracy.class);

		job4.setJarByClass(MapReduceNBTest.class);

		job4.setInputFormatClass(TextInputFormat.class);
		job4.setOutputFormatClass(TextOutputFormat.class);

		job4.waitForCompletion(true);

	}