code: public double[][] to2D(double[] weights) {
      double[][] newWeights = new double[map.length][];
      int index = 0;
      for (int i = 0; i < map.length; i++) {
        newWeights[i] = new double[labelIndices[map[i]].size()];
        System.arraycopy(weights, index, newWeights[i], 0, labelIndices[map[i]].size());
        index += labelIndices[map[i]].size();
      }
      return newWeights;
    }
docs: Takes a double array of weights and creates a 2D array where:
  
  the first element is the mapped index of featuresIndex
  the second element is the index of the of the element
  
  @return a 2D weight array