code: def test_estimator_with_h2o_frames(estimator_cls):
      args = _get_default_args(estimator_cls)
      estimator = estimator_cls(**args)
  
      data = _get_data(
          format="h2o",
          n_classes=_get_custom_behaviour(estimator_cls).get(
              "n_classes", 2
          ),
      )
      assert isinstance(data.X_train, h2o.H2OFrame)
      requires_target = _get_custom_behaviour(estimator_cls).get(
          "requires_target", True
      )
      estimator.fit(
          data.X_train, data.y_train if requires_target else None
      )
      preds = estimator.predict(data.X_test)
      print(preds)
      assert isinstance(preds, h2o.H2OFrame)
      if _get_custom_behaviour(estimator_cls).get(
          "preds_as_vector", True
      ):
          assert preds.dim == [len(data.X_test), 1], "got {}".format(
              preds.dim
          )
      else:
          assert preds.dim[0] == len(data.X_test)
  
      if _get_custom_behaviour(estimator_cls).get(
          "predict_proba", True
      ):
          probs = estimator.predict_proba(data.X_test)
          print(probs)
          assert probs.dim == [len(data.X_test), 2], "got {}".format(
              probs.dim
          )
          assert np.allclose(
              np.sum(probs.as_data_frame().values, axis=1), 1.0
          ), "`predict_proba` didn't return probabilities"
      else:
          assert not hasattr(estimator, "predict_proba")
  
      if _get_custom_behaviour(estimator_cls).get("score", True):
          score = estimator.score(data.X_test, data.y_test)
          assert isinstance(score, float)
          skl_score = accuracy_score(
              data.y_test.as_data_frame().values,
              preds.as_data_frame().values,
          )
          assert (
              abs(score - skl_score) < 1e-6
          ), "score={}, skl_score={}".format(score, skl_score)
          scores[estimator_cls].update(with_h2o_frames=score)
      else:
          assert not hasattr(estimator, "score")
  
file_path: h2o-3/h2o-py/tests/testdir_sklearn/pyunit_sklearn_generic_all_estimators.py
imports: from collections import defaultdict
  from functools import partial
  import gc, inspect, os, sys
  import numpy
  from sklearn.datasets import make_classification, make_regression
  from sklearn.metrics import accuracy_score
  from sklearn.model_selection import train_test_split
  import h2o
  from h2o.sklearn.wrapper import H2OConnectionMonitorMixin
  from tests import pyunit_utils, Namespace
label_desc: Use image node_id 4 for calling a global function with example usage: test_estimator_with_h2o_frames(estimator_cls) without return types