public RuleBased(GenData gen) throws IOException{
    	this.data = gen;
    	writer =  new BufferedWriter(new FileWriter("featureMatrix.txt"));
    	y =  new BufferedWriter(new FileWriter("label.txt"));
    	for(User u:data.userMap.values()){
    		u.addDiffFeature();
    		for(int i=0; i<featuresize; i++){
    		   if(u.features.get(i) > maxPerFeature[i]){
    			   maxPerFeature[i] = u.features.get(i);
    		   }	
    		}    		
    	}
    	
    	for(Business b:data.businessMap.values()){
    		labels.add(b.stars);
    		List<Double> sample;
    		double [] featureForWeight = new double[featuresize];
    		int numuser = 0;
    		for(User u:b.users){
    			numuser++;
    			sample = u.multiply(b, maxPerFeature);
    			aggregate(sample, featureForWeight);
    		}
    		for(int i=0; i<featuresize; i++){
    			writer.write(featureForWeight[i]+"\t");
    		}
    		y.write(numuser*b.stars+"\n");
    		writer.write("\n");
    	}
    	writer.close();
    	y.close();
    	
    	// add reading the weights learnt and then call calcCredibility
    }