code: def test_make_leaderboard_with_leaderboard_frame():
      train = h2o.upload_file(
          pyunit_utils.locate("smalldata/titanic/titanic_expanded.csv")
      )
      train["name"] = train["name"].asfactor()
      y = "fare"
  
      aml = H2OAutoML(seed=1234, max_models=5)
      aml.train(y=y, training_frame=train)
  
      aml2 = H2OAutoML(seed=134, max_models=5)
      aml2.train(y=y, training_frame=train)
  
      grid = H2OGridSearch(
          H2OGradientBoostingEstimator(),
          hyper_params={"ntrees": [1, 2, 3]},
      )
      grid.train(y=y, training_frame=train)
      # with leaderboard frame
      expected_cols = (
          "model_id",
          "rmse",
          "mse",
          "mae",
          "rmsle",
          "mean_residual_deviance",
          "training_time_ms",
          "predict_time_per_row_ms",
          "algo",
      )
      ldb = h2o.make_leaderboard(aml, train, extra_columns="ALL")
  
      for c in expected_cols:
          assert c in ldb.columns
  
      for score_data in ("AUTO", "xval", "valid", "train"):
          assert (
              h2o.make_leaderboard(
                  aml, train, scoring_data=score_data
              ).nrow
              > 0
          )
          assert (
              h2o.make_leaderboard(
                  [aml, aml2], train, scoring_data=score_data
              ).nrow
              > 0
          )
          assert (
              h2o.make_leaderboard(grid, scoring_data=score_data).nrow
              > 0
          )
          assert (
              h2o.make_leaderboard(
                  [aml, grid, aml2.leader],
                  train,
                  scoring_data=score_data,
              ).nrow
              > 0
          )
  
      # extra columns
      for ec in ("training_time_ms", "predict_time_per_row_ms", "algo"):
          assert (
              ec
              in h2o.make_leaderboard(
                  grid, train, extra_columns=ec
              ).columns
          )
  
      # extra columns without leaderboard frame
      for ec in ("training_time_ms", "algo"):
          assert (
              ec in h2o.make_leaderboard(grid, extra_columns=ec).columns
          )
  
      # sort metrics
      for sm in (
          "rmse",
          "mse",
          "mae",
          "rmsle",
          "mean_residual_deviance",
      ):
          assert (
              h2o.make_leaderboard(grid, train, sort_metric=sm).columns[
                  1
              ]
              == sm
          )
  
file_path: h2o-3/h2o-py/tests/testdir_misc/explain/pyunit_make_leaderboard.py
imports: import os
  import sys
  import h2o
  import h2o.exceptions
  from tests import pyunit_utils, dataset_prostate, CustomMaeFunc
  from h2o.automl import H2OAutoML
  from h2o.estimators import *
  from h2o.grid import H2OGridSearch
label_desc: Use image node_id 3 for calling a global function with example usage: test_make_leaderboard_with_leaderboard_frame() without return types