code: public void setRegularization(double regularization)
      {
          if (Double.isInfinite(regularization) || Double.isNaN(regularization) || regularization <= 0)
              throw new IllegalArgumentException("Regularization must be a positive value");
          this.reg = regularization;
      }
docs: Sets the regularization constant used for learning. The regularization
  must be positive, and the learning rate is proportional to the
  regularization value. This means regularizations very near zero will take
  a long time to converge.
  
  @param regularization the regularization to apply in (0, Infinity)