public void rule_mapred() throws Exception
    {
    	fs.delete(path, true);
    	JobConf job = new JobConf(getConf(), WordCount.class);
        job.setJarByClass(WordCount.class);
        job.setJobName("Rule Based Classifier");
        job.set("attr_num", String.valueOf(attr_num));
        job.set("attr_value", attr_value);
        job.set("rule_no", String.valueOf(rule_no));
        
        for(int i1=0;i1<=rule_no;i1++)
        {
        	job.set("length"+i1, String.valueOf(rule[i1].length));
        	job.set("class_name"+i1, rule[i1].class_name);
        	for(int i2=0;i2<rule[i1].length;i2++)
        	{
        		job.set("rule_num"+i1+i2, String.valueOf(rule[i1].num[i2]));
        		job.set("rule_value"+i1+i2, rule[i1].val[i2]);
        	}
        }
        
        FileInputFormat.setInputPaths(job, new Path(input));
        FileOutputFormat.setOutputPath(job, new Path(output));

        job.setMapperClass(WordCountMapper.class);
        job.setReducerClass(WordCountReducer.class);

        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(IntWritable.class);
        
        RunningJob job1 = JobClient.runJob(job);
        Counters c = job1.getCounters();
        p1 = (int)c.getCounter(Counter.P1);
        n1 = (int)c.getCounter(Counter.N1);
        
        if(p0 == 0 && n0 == 0 && rule[rule_no].class_name.equals("p"))
        {
        	n0 = 2761;
        	p0 = 2571;
        }
        else if(p0 == 0 && n0 == 0 && rule[rule_no].class_name.equals("e"))
        {
        	p0 = 2761;
        	n0 = 2571;
        }
        
        if (p1 == 0 | n1 > 0)
			gain = 0; 
        else 
        {
			newGain = log2((double) p1 / (double) (p1 + n1));
			oldGain = log2((double) p0 / (double) (p0 + n0));
			gain = p1 * (newGain - oldGain);
        }
        
        System.out.println(gain);
    }