public void train() {
    int iter = 0;
    boolean converged = false;
    float[] last = new float[model.length];
    while (iter < maxIter && !converged) {
      System.err.print(".");
      trainIteration();
      converged = true;
      for (int j = 0; j < model.length; ++j) {
        if (Math.abs(model[j] - last[j]) > epsilon) {
          converged = false;
          break;
        }
      }
      last = Arrays.copyOf(model, model.length);
      iter++;
    }
    if (converged) {
      System.err.println("\nLR classifier converge in " + iter + " iterations");
    } else {
      System.err.println("\nLR does not converge in " + iter + "iterations");
    }
    // System.err.println(Arrays.toString(classifier));
    // System.err.println(bias);
  }