code: def main():
      parser = argparse.ArgumentParser()
      parser.add_argument(
          "--smoke-test",
          action="store_true",
          default=False,
          help="Finish quickly for testing.",
      )
      args, _ = parser.parse_known_args()
  
      # __tune_begin__
      from ray import tune
  
      # Set config
      config = {
          "tree_method": "approx",
          "objective": "binary:logistic",
          "eval_metric": ["logloss", "error"],
          "eta": tune.loguniform(1e-4, 1e-1),
          "subsample": tune.uniform(0.5, 1.0),
          "max_depth": tune.randint(1, 9),
      }
      # __tune_end__
  
      # __tune_run_begin__
      analysis = tune.run(
          train_model,
          config=config,
          metric="eval-error",
          mode="min",
          num_samples=4 if not args.smoke_test else 1,
          resources_per_trial=RayParams(
              num_actors=num_actors, cpus_per_actor=num_cpus_per_actor
          ).get_tune_resources(),
      )
  
      # Load in the best performing model.
      best_bst = load_best_model(analysis.best_trial.local_path)
  
      # Use the following code block instead if using Ray Client.
      # import ray
      # if ray.util.client.ray.is_connected():
      #     # If using Ray Client best_logdir is a directory on the server.
      #     # So we want to make sure we wrap model loading in a task.
      #     remote_load_fn = ray.remote(load_best_model)
      #     best_bst = ray.get(remote_load_fn.remote(analysis.best_trial.local_path))
  
      # Do something with the best model.
      _ = best_bst
  
      accuracy = 1.0 - analysis.best_result["eval-error"]
      print(f"Best model parameters: {analysis.best_config}")
      print(f"Best model total accuracy: {accuracy:.4f}")
  
imports: import argparse
  from sklearn import datasets
  from sklearn.model_selection import train_test_split
  from xgboost_ray import RayDMatrix, RayParams, train
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types