public static Double getClassByKnn(TrainingSet trainingSet,Map<Integer,Double> pKeyDistanceMap,Integer k){
        int i = 0;
        int positiveExamples = 0, negativeExamples = 0;
        for(Map.Entry<Integer,Double> entry : pKeyDistanceMap.entrySet()){
            if( i < k )
                if( Double.compare(trainingSet.trainingSet.get(entry.getKey()).get(0), trainingSet.positiveClass) ==0 )
                    positiveExamples++;
                else
                    negativeExamples++;
            else
                break;
            i++;
        }
        
        if(negativeExamples > positiveExamples)
            return trainingSet.negativeClass;
        else
            return trainingSet.positiveClass;
    }