Example #1
0
  @Override
  public void modifyParmsForCrossValidationMainModel(ModelBuilder[] cvModelBuilders) {
    _parms._overwrite_with_best_model = false;

    if (_parms._stopping_rounds == 0 && _parms._max_runtime_secs == 0)
      return; // No exciting changes to stopping conditions
    // Extract stopping conditions from each CV model, and compute the best stopping answer
    _parms._stopping_rounds = 0;
    _parms._max_runtime_secs = 0;
    double sum = 0;
    for (ModelBuilder cvmb : cvModelBuilders)
      sum += ((DeepLearningModel) DKV.getGet(cvmb.dest())).last_scored().epoch_counter;
    _parms._epochs = sum / cvModelBuilders.length;
    if (!_parms._quiet_mode) {
      warn(
          "_epochs",
          "Setting optimal _epochs to "
              + _parms._epochs
              + " for cross-validation main model based on early stopping of cross-validation models.");
      warn(
          "_stopping_rounds",
          "Disabling convergence-based early stopping for cross-validation main model.");
      warn(
          "_max_runtime_secs",
          "Disabling maximum allowed runtime for cross-validation main model.");
    }
  }
  public static H2OModelBuilderIllegalArgumentException makeFromBuilder(ModelBuilder builder) {
    Model.Parameters parameters = builder._parms;
    String algo = builder._parms.algoName();
    String msg =
        "Illegal argument(s) for "
            + algo
            + " model: "
            + builder.dest()
            + ".  Details: "
            + builder.validationErrors();

    H2OModelBuilderIllegalArgumentException exception =
        new H2OModelBuilderIllegalArgumentException(msg, msg);

    exception.values = new IcedHashMap.IcedHashMapStringObject();
    exception.values.put("algo", algo);
    exception.values.put("parameters", parameters);
    exception.values.put("error_count", builder.error_count());
    exception.values.put("messages", builder._messages);

    return exception;
  }