public List<TrainingSet> kFoldPartition(Integer k, Integer fold){
        Integer foldSize,i = 0;
        foldSize = trainingSet.size() / k;
        TrainingSet set1 = new TrainingSet(this), set2 = new TrainingSet(this);
        List<TrainingSet> list = new ArrayList<TrainingSet>();

        for( Map.Entry<Integer, List<Double>> entry : trainingSet.entrySet() )
        {
            if( i >= (fold-1)*foldSize && i < (fold)*foldSize  )  //si forma parte del fold
                set1.trainingSet.remove(entry.getKey()); //trainingSet
            else
                set2.trainingSet.remove(entry.getKey());    //validationSet
            i++;
        }
        list.add(set1);
        list.add(set2);
        return list;
    }