docs: 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;
    }