code: def mojo_predict_pandas_test(sandbox_dir):
      data = h2o.import_file(
          path=pyunit_utils.locate("smalldata/logreg/prostate.csv")
      )
  
      input_csv = "%s/in.csv" % sandbox_dir
      pdf = data[1, 2:]
      h2o.export_file(pdf, input_csv)
  
      data[1] = data[1].asfactor()
      model = H2OGradientBoostingEstimator(distribution="bernoulli")
      model.train(x=[2, 3, 4, 5, 6, 7, 8], y=1, training_frame=data)
  
      h2o_prediction = model.predict(pdf)
      h2o_contributions = model.predict_contributions(pdf)
  
      # download mojo
      model_zip_path = os.path.join(sandbox_dir, "model.zip")
      genmodel_path = os.path.join(sandbox_dir, "h2o-genmodel.jar")
      download_mojo(model, model_zip_path)
      assert os.path.isfile(model_zip_path)
      assert os.path.isfile(genmodel_path)
  
      pandas_frame = pandas.read_csv(input_csv)
      mojo_prediction = h2o.mojo_predict_pandas(
          dataframe=pandas_frame,
          mojo_zip_path=model_zip_path,
          genmodel_jar_path=genmodel_path,
      )
      print(
          "Binomial Prediction (Binary) - p0: %f" % h2o_prediction[0, 1]
      )
      print(
          "Binomial Prediction (Binary) - p1: %f" % h2o_prediction[0, 2]
      )
      print(
          "Binomial Prediction (MOJO) - p0: %f"
          % mojo_prediction["p0"].iloc[0]
      )
      print(
          "Binomial Prediction (MOJO) - p1: %f"
          % mojo_prediction["p1"].iloc[0]
      )
      assert (
          abs(h2o_prediction[0, 1] - mojo_prediction["p0"].iloc[0])
          < 1e-15
      ), "expected predictions to be the same for binary and MOJO model - p0"
      assert (
          abs(h2o_prediction[0, 2] - mojo_prediction["p1"].iloc[0])
          < 1e-15
      ), "expected predictions to be the same for binary and MOJO model - p0"
  
      mojo_contributions = h2o.mojo_predict_pandas(
          dataframe=pandas_frame,
          mojo_zip_path=model_zip_path,
          genmodel_jar_path=genmodel_path,
          predict_contributions=True,
      )
      assert_frame_equal(
          h2o_contributions.as_data_frame(use_pandas=True),
          mojo_contributions,
          check_dtype=False,
      )
  
file_path: h2o-3/h2o-py/tests/testdir_misc/pyunit_mojo_predict.py
imports: import sys
  import tempfile
  import shutil
  import time
  import os
  import pandas
  from pandas.testing import assert_frame_equal
  import h2o
  from tests import pyunit_utils
  from h2o.estimators.gbm import H2OGradientBoostingEstimator
label_desc: Use image node_id 4 for calling a global function with example usage: mojo_predict_pandas_test(sandbox_dir) without return types