code: def main():
      # __tune_begin__
      from ray import tune
  
      # Set config
      config = {
          "objective": "binary",
          "metric": ["binary_logloss", "binary_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-binary_error",
          mode="min",
          num_samples=4,
          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-binary_error"]
      print(f"Best model parameters: {analysis.best_config}")
      print(f"Best model total accuracy: {accuracy:.4f}")
  
imports: from sklearn import datasets
  from sklearn.model_selection import train_test_split
  from lightgbm_ray import RayDMatrix, RayParams, train
label_desc: Use image node_id 3 for calling a global function with example usage: main() without return types