private List<Instance> featureSelect(List<Instance> instances, int num_features_to_select){
        if(instances==null) return null;
        if(num_features_to_select<=0) return instances;
        Mean mean = new Mean(instances);
        InformationGain IG = new InformationGain(instances,mean);
        HashSet<Integer> featureIDs = IG.getTopIG(num_features_to_select);
        for(Instance instance : instances){
            Iterator<Integer> it = instance.getFeatureVector().getKey();
            while(it.hasNext()){
                int key = it.next();
                if(!featureIDs.contains(key))
                    it.remove();
            }
        }
        return instances;
    }