code: def objective(
      trial: optuna.trial.Trial,
      metric: str = "binary_error",
      valid_name: str = "valid_0",
      interval: int = 1,
      num_boost_round: int = 1,
      force_default_valid_names: bool = False,
      cv: bool = False,
  ) -> float:
      dtrain = lgb.Dataset(
          np.asarray([[1.0], [2.0], [3.0], [4.0]]),
          label=[1.0, 0.0, 1.0, 0.0],
      )
      dtest = lgb.Dataset(np.asarray([[1.0]]), label=[1.0])
  
      if force_default_valid_names:
          valid_names = None
      else:
          valid_names = [valid_name]
  
      verbose_callback = lgb.log_evaluation()
      pruning_callback = LightGBMPruningCallback(
          trial, metric, valid_name=valid_name, report_interval=interval
      )
      if cv:
          lgb.cv(
              {
                  "objective": "binary",
                  "metric": ["auc", "binary_error"],
              },
              dtrain,
              num_boost_round,
              nfold=2,
              callbacks=[verbose_callback, pruning_callback],
          )
      else:
          lgb.train(
              {
                  "objective": "binary",
                  "metric": ["auc", "binary_error"],
              },
              dtrain,
              num_boost_round,
              valid_sets=[dtest],
              valid_names=valid_names,
              callbacks=[verbose_callback, pruning_callback],
          )
      return 1.0
  
file_path: optuna/tests/integration_tests/test_lightgbm.py
imports: from functools import partial
  from unittest.mock import patch
  import numpy
  import pytest
  import optuna
  from optuna._imports import try_import
  from optuna.integration.lightgbm import LightGBMPruningCallback
  from optuna.testing.pruners import DeterministicPruner
label_desc: Use image node_id 5 for calling a global function with example usage: objective(trial, metric, valid_name, interval, num_boost_round, force_default_valid_names, cv) and returns: int