code: def test_early_stopping_defaults():
      print("Check default early stopping params")
      ds = import_dataset()
      aml = H2OAutoML(
          project_name="py_aml_early_stopping_defaults",
          max_models=max_models,
      )
      aml.train(y=ds.target, training_frame=ds.train)
      stopping_criteria = aml._build_resp["build_control"][
          "stopping_criteria"
      ]
      print(stopping_criteria)
  
      from math import sqrt
  
      auto_stopping_tolerance = (
          lambda fr: min(
              0.05,
              max(
                  0.001,
                  1
                  / sqrt(
                      (1 - sum(fr.nacnt()) / (fr.ncols * fr.nrows))
                      * fr.nrows
                  ),
              ),
          )
      )(ds.train)
  
      assert stopping_criteria["stopping_rounds"] == 3
      assert (
          stopping_criteria["stopping_tolerance"]
          == auto_stopping_tolerance
      )
      assert stopping_criteria["stopping_metric"] == "AUTO"
      assert stopping_criteria["max_models"] == max_models
      assert stopping_criteria["max_runtime_secs"] == 0
      assert stopping_criteria["max_runtime_secs_per_model"] == 0
  
file_path: h2o-3/h2o-py/tests/testdir_algos/automl/pyunit_automl_early_stopping.py
imports: import sys, os
  from h2o.exceptions import H2OJobCancelled
  from h2o.automl import H2OAutoML
  from tests import pyunit_utils
  from _automl_utils import import_dataset, get_partitioned_model_names
label_desc: Use image node_id 1 for calling a global function with example usage: test_early_stopping_defaults() without return types