@Override
 public double predict(double[] feature) {
   double[] probs = probs(feature);
   int[] index = RandomUtils.getIndexes(classCount);
   SortIntDoubleUtils.sort(index, probs);
   return index[index.length - 1];
 }
  @Override
  public void initialize(DataSet d) {

    trainData = d;
    indices = new TIntArrayList(RandomUtils.getIndexes(d.getInstanceLength()));
    classCount = trainData.getLabels().getClassIndexMap().size();
    scoreCache = new float[trainData.getInstanceLength()][classCount];
    roundData = new DataSet[classCount];
    roundIndices = new int[(int) (trainData.getInstanceLength() * SAMPLE_RATE)];
    tempLabels = new float[classCount][trainData.getInstanceLength()];

    indices.shuffle(new Random());
    for (int j = 0; j < roundIndices.length; j++) roundIndices[j] = indices.get(j);

    for (int j = 0; j < classCount; j++) {
      roundData[j] = new DataSet(trainData.getFeatureMatrix(), makeClassLabel(j));
    }

    log.info(
        "initialize finished, tempLabels + ScoreCache MEM use ~ {} GB",
        2.0 * scoreCache.length * scoreCache[0].length * 4 / 1024 / 1024 / 1024);
  }