code: def objective(trial):
      data, target = sklearn.datasets.load_breast_cancer(
          return_X_y=True
      )
      train_x, valid_x, train_y, valid_y = train_test_split(
          data, target, test_size=0.25
      )
      dtrain = lgb.Dataset(train_x, label=train_y)
      dvalid = lgb.Dataset(valid_x, label=valid_y)
  
      param = {
          "objective": "binary",
          "metric": "auc",
          "verbosity": -1,
          "boosting_type": "gbdt",
          "bagging_fraction": min(
              trial.suggest_float("bagging_fraction", 0.4, 1.0 + 1e-12),
              1,
          ),
          "bagging_freq": trial.suggest_int("bagging_freq", 0, 7),
          "min_child_samples": trial.suggest_int(
              "min_child_samples", 5, 100
          ),
      }
  
      # Add a callback for pruning.
      pruning_callback = optuna.integration.LightGBMPruningCallback(
          trial, "auc"
      )
      gbm = lgb.train(
          param,
          dtrain,
          valid_sets=[dvalid],
          callbacks=[pruning_callback],
      )
  
      preds = gbm.predict(valid_x)
      pred_labels = np.rint(preds)
      accuracy = sklearn.metrics.accuracy_score(valid_y, pred_labels)
      return accuracy
  
file_path: optuna/tutorial/20_recipes/008_specify_params.py
imports: import lightgbm
  import numpy
  import sklearn.datasets
  import sklearn.metrics
  from sklearn.model_selection import train_test_split
  import optuna
  import logging
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: objective(trial) and returns: accuracy