public void UD(int nbUsers, int numberTrainingExamples, int normalisation) {
    List<List<int[][]>> usersConfusionMatrixes = new ArrayList<List<int[][]>>();
    for (int user = 1; user <= nbUsers; user++) {
      List<int[][]> userConfusionMatrixes = new ArrayList<int[][]>();
      for (int knn = 0; knn < numberTrainingExamples; knn++)
        userConfusionMatrixes.add(new int[10][10]);
      usersConfusionMatrixes.add(userConfusionMatrixes);
    }

    String[] alphabet = {"0", "1", "2", "3", "4", "5", "6", "7"};
    ConditionalRecognizer cr = new ConditionalRecognizer(alphabet);
    for (int user = 1; user <= nbUsers; user++)
      for (int teIndex = 1; teIndex <= numberTrainingExamples; teIndex++)
        cr.addTemplate(user + "", strings.get("" + user + "signature" + teIndex));

    cr.compile(normalisation);

    for (int knn = numberTrainingExamples; knn <= numberTrainingExamples; knn++) {
      for (int user = 1; user <= nbUsers; user++)
        for (int teIndex = numberTrainingExamples + 1; teIndex <= 30; teIndex++) {
          String[] foundSigs =
              cr.recognizeForAllKnn(strings.get(user + "signature" + teIndex), normalisation, knn);
          for (int i = 0; i < foundSigs.length; i++) {
            String foundSig = foundSigs[i];
            confusionMatrixes.get(i)[user - 1][Integer.parseInt(foundSig) - 1]++;
            usersConfusionMatrixes.get(user - 1).get(i)[user - 1][Integer.parseInt(foundSig) - 1]++;
          }
        }
      System.out.println(
          "norm="
              + normalisation
              + "|nte="
              + numberTrainingExamples
              + "|nbUsers="
              + nbUsers
              + " recognized");
    }

    for (int user = 1; user <= nbUsers; user++)
      for (int knn = 0; knn < numberTrainingExamples; knn++)
        userRecognitionRates[user - 1][knn] =
            Utils.recognitionRate(usersConfusionMatrixes.get(user - 1).get(knn));
    //		tw.println("norm="+normalisation+"|nte="+numberTrainingExamples+"|user="******": recognition
    // rate = "+Utils.recognitionRate(userConfusionMatrix));
  }
  public void UI(int user, int numberTrainingExamples, int normalisation) {
    List<int[][]> userConfusionMatrixes = new ArrayList<int[][]>();
    for (int knn = 0; knn < numberTrainingExamples; knn++)
      userConfusionMatrixes.add(new int[10][10]);
    for (int firstUserIndex = 1; firstUserIndex <= 10; firstUserIndex++) {
      String[] alphabet = {"0", "1", "2", "3", "4", "5", "6", "7"};
      ConditionalRecognizer cr = new ConditionalRecognizer(alphabet);
      for (int digitIndex = 0; digitIndex < 10; digitIndex++) {
        int mod = 0;
        int threshold = firstUserIndex + numberTrainingExamples;
        for (int otherUser = firstUserIndex; mod * 10 + otherUser < threshold; otherUser++) {
          if (otherUser == user) {
            if (otherUser == 10) {
              otherUser = 1;
              mod = 1;
            } else otherUser++;
            threshold++;
          }
          cr.addTemplate(
              Utils.intToDigit(digitIndex) + "",
              strings.get("" + otherUser + Utils.intToDigit(digitIndex) + "1"));

          if (otherUser == 10) {
            otherUser = 0;
            mod = 1;
          }
        }
      }

      cr.compile(normalisation);

      for (int knn = numberTrainingExamples; knn <= numberTrainingExamples; knn++) {
        for (int digitIndex = 0; digitIndex < 10; digitIndex++) {
          for (int teIndex = 1; teIndex <= 10; teIndex++) {

            String[] foundDigits =
                cr.recognizeForAllKnn(
                    strings.get("" + user + Utils.intToDigit(digitIndex) + teIndex),
                    normalisation,
                    knn);
            for (int i = 0; i < foundDigits.length; i++) {
              String foundDigit = foundDigits[i];
              confusionMatrixes.get(i)[digitIndex][Utils.digitToInt(foundDigit)]++;
              userConfusionMatrixes.get(i)[digitIndex][Utils.digitToInt(foundDigit)]++;
            }
            System.out.println(
                "norm="
                    + normalisation
                    + "|nte="
                    + numberTrainingExamples
                    + "|user="******"|fui="
                    + firstUserIndex
                    + "|char="
                    + Utils.intToDigit(digitIndex)
                    + " recognized");
          }
        }
      }
    }
    for (int knn = 0; knn < numberTrainingExamples; knn++)
      userRecognitionRates[user - 1][knn] = Utils.recognitionRate(userConfusionMatrixes.get(knn));
  }