static double entropyCalcExt(Attribute attr,ArrayList<LearningObject> set){
		
		//posCol position of interested attribute
		
		Integer posCol = attr.posInLearningSet;
		double entropy = 0;
	
		
		if(attr.type == Attribute.DISCRET){
			
			//determine number of classes
			HashMap<String,ArrayList<LearningObject>> newLearningSet = new HashMap<String, ArrayList<LearningObject>>();
			
			for(int i=0;i<set.size();i++){
			
					ArrayList<LearningObject> val = newLearningSet.get((String)set.get(i).values.get(posCol).getValue());
					
					if(val == null){
						val =new ArrayList<LearningObject>();
						val.add(set.get(i));
						newLearningSet.put(set.get(i).values.get(posCol).valueString, val);
					}
					else{
						val.add(set.get(i));
					}	
				}
			int totalNo = set.size();
			
			
			Set<Entry<String,ArrayList<LearningObject>>> setVal =  newLearningSet.entrySet();
			
			Iterator<Entry<String,ArrayList<LearningObject>>> it = setVal.iterator();
			
			while(it.hasNext()){
				
				Entry<String,ArrayList<LearningObject>> entry =  it.next();
				//System.out.println(entry.getValue().size() +" /" + totalNo + " " + entropyCalc(entry.getValue()) +" dim:"+ entry.getValue().size());
				
				entropy += ( ((double)entry.getValue().size())/totalNo)* entropyCalc(entry.getValue());
			}
		//	System.out.println("- - -");

		}
		else
		{
			// if attribute is NUMERIC and has been DISCRETIZED
			ArrayList<Interval> intervals = attr.numericIntervalBounds;
			int totalNo = set.size();
			
			//System.out.println("Intervals :" + intervals.size());
			for(int i=0;i<intervals.size();i++){
				Interval interval = intervals.get(i);
				//System.out.println("Interval bounds ["+ interval.lowBound +" " + interval.highBound + "]");
				ArrayList<LearningObject> newSet = new ArrayList<LearningObject>();
				
				for(int j=0;j<set.size();j++){
					if(interval.isValueInInterval((Integer)set.get(j).values.get(posCol).getValue()))
						newSet.add(set.get(j));
				}
				
				//in the new set will be attributes in that specific interval
				// newSet size number of learningObject that have numeric attribute in that interval
				// totalNo the total number of learning Pbjects in the set
				if(newSet.size()>0){
					//System.out.println(newSet.size() +" /" + totalNo + " " + entropyCalc(newSet) +" dim:"+ newSet.size());
					
					
					entropy += ((double)newSet.size()/totalNo) * entropyCalc(newSet);
				}	
			}		
		}
		
		return entropy;
	}