public static double calculateInfoGainNominal (double colOfAttrValues[], double attrUniqVals[], double classEntropy, double[] labelValues, double[] uniqueLabelValues){
		double entropy = 0;
		double subEntropy = 0;
		double probability = 0;
		int attrValCnt =0;
		double attrEntropy =0;
		double infoGain=0;

		ArrayList<Double> subEntropies = new ArrayList<Double>();

		int numInst= colOfAttrValues.length;

		if(colOfAttrValues.length == 0) {
			return 0; //no instances to consider
		}

		//loop for each of the distinct value of the attribute
		for(int colValUcnt=0;  colValUcnt<attrUniqVals.length ; colValUcnt++) {

			entropy =0;
			subEntropy = 0;
			attrValCnt =0;			
			double colUniqValue = attrUniqVals[colValUcnt]; 
			int attrClCnt;
			HashMap<Double, Integer> attrValClMap = new HashMap<Double, Integer>();

//			System.out.println("attribute value: "+colUniqValue);

			//Keeps track of how the instances are distributed across different classes
			//Initialization
			for(int label=0;label<uniqueLabelValues.length;label++)
				attrValClMap.put(uniqueLabelValues[label], 0);

			for(int r=0;r<numInst ;r++){	
				if(colOfAttrValues[r]==colUniqValue)	{		
					attrClCnt = attrValClMap.get(labelValues[r]);
					attrClCnt++;
					attrValClMap.put(labelValues[r], attrClCnt);
					attrValCnt++; 	
				}
			}

			if(attrValCnt > 0) { //if greater than 0 like 8 in my example
				for(int cl=0;cl<uniqueLabelValues.length;cl++){					
					int clattrCnt = attrValClMap.get(uniqueLabelValues[cl]);
					if(clattrCnt>0){ //If there are items in a particular class
						probability = (double)clattrCnt / attrValCnt;
						entropy += (-probability * (Math.log(probability) / Math.log(2)));
					}
				}				
//				System.out.println("attrValCnt  "+ attrValCnt+" numInst  "+ numInst);
				subEntropy = ((double)attrValCnt/numInst)*entropy;
//				System.out.println("entropy: "+entropy+" subEntropy of attr:  "+ subEntropy);
			}		
			subEntropies.add(subEntropy);
		}	//for each distinct value of entropy

		for(double d : subEntropies)
			attrEntropy += d; //This is E(Age) in Dr. Ng's Lecture of Data Mining

		//Info gain= clEntropy- sum of all sub entropies
		infoGain = classEntropy-attrEntropy;  //This is Gain(Age) in Dr. Ng's Lecture of Data Mining

		System.out.println("Info gain: "+	infoGain);
		return infoGain;
	}