code: def test_estimator_with_numpy_arrays(estimator_cls):
      estimator = estimator_cls(
          init_connection_args=init_connection_args,
          **_get_default_args(estimator_cls),
      )
  
      data = _get_data(
          format="numpy",
          n_classes=_get_custom_behaviour(estimator_cls).get(
              "n_classes", 2
          ),
      )
      assert isinstance(data.X_train, np.ndarray)
  
      with estimator:
          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, np.ndarray)
          if _get_custom_behaviour(estimator_cls).get(
              "preds_as_vector", True
          ):
              assert preds.shape == (
                  len(data.X_test),
              ), "got {}".format(preds.shape)
          else:
              assert preds.shape[0] == len(data.X_test)
  
          # print(estimator.fit_predict(data.X_train, data.y_train if requires_target else None))
  
          if _get_custom_behaviour(estimator_cls).get(
              "predict_proba", True
          ):
              probs = estimator.predict_proba(data.X_test)
              print(probs)
              assert probs.shape == (len(data.X_test), 2)
              assert np.allclose(
                  np.sum(probs, 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, preds)
              assert abs(score - skl_score) < 1e-6
              scores[estimator_cls].update(with_numpy_arrays=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 5 for calling a global function with example usage: test_estimator_with_numpy_arrays(estimator_cls) without return types