@Override
  public PredictedLabels predictForTest(
      Example vector, Vector W, String realClass, ClassifierData classifierData, int returnAll) {

    if (returnAll != Consts.ERROR_NUMBER) {
      try {
        PredictedLabels tree = new PredictedLabels();

        // validation
        if (vector.sizeOfVector <= 0) {
          Logger.error(ErrorConstants.PHI_VECTOR_DATA);
          return null;
        }

        for (int i = 0; i < numOfClass; i++) {
          Example phiData =
              classifierData.phi.convert(vector, String.valueOf(i), classifierData.kernel);

          // multiple the vectors
          double tmp = MathHelpers.multipleVectors(W, phiData.getFeatures());

          // get the max value for the max classification
          tree.put(String.valueOf(i), tmp);
        }

        MapValueComparatorDescending vc = new MapValueComparatorDescending(tree);
        PredictedLabels result = new PredictedLabels(vc);
        result.putAll(tree);

        return result;

      } catch (Exception e) {
        e.printStackTrace();
        return null;
      }
    } else return predictForTrain(vector, W, realClass, classifierData, 0);
  }