code: def _get_improvement_info(
      study: Study,
      get_error: bool = False,
      improvement_evaluator: BaseImprovementEvaluator | None = None,
      error_evaluator: BaseErrorEvaluator | None = None,
  ) -> _ImprovementInfo:
      if study._is_multi_objective():
          raise ValueError(
              "This function does not support multi-objective optimization study."
          )
  
      if improvement_evaluator is None:
          improvement_evaluator = RegretBoundEvaluator()
      if error_evaluator is None:
          error_evaluator = CrossValidationErrorEvaluator()
  
      trial_numbers = []
      completed_trials = []
      improvements = []
      errors = []
  
      for trial in tqdm.tqdm(study.trials):
          if trial.state == optuna.trial.TrialState.COMPLETE:
              completed_trials.append(trial)
  
          if len(completed_trials) == 0:
              continue
  
          trial_numbers.append(trial.number)
  
          improvement = improvement_evaluator.evaluate(
              trials=completed_trials, study_direction=study.direction
          )
          improvements.append(improvement)
  
          if get_error:
              error = error_evaluator.evaluate(
                  trials=completed_trials,
                  study_direction=study.direction,
              )
              errors.append(error)
  
      if len(errors) == 0:
          return _ImprovementInfo(
              trial_numbers=trial_numbers,
              improvements=improvements,
              errors=None,
          )
      else:
          return _ImprovementInfo(
              trial_numbers=trial_numbers,
              improvements=improvements,
              errors=errors,
          )
  
imports: from __future__ import annotations
  from typing import NamedTuple
  import tqdm
  import optuna
  from optuna._experimental import experimental_func
  from optuna.logging import get_logger
  from optuna.study.study import Study
  from optuna.terminator import BaseErrorEvaluator
  from optuna.terminator import BaseImprovementEvaluator
  from optuna.terminator import CrossValidationErrorEvaluator
  from optuna.terminator import RegretBoundEvaluator
  from optuna.terminator.improvement.evaluator import DEFAULT_MIN_N_TRIALS
  from optuna.visualization._plotly_imports import _imports
label_desc: Use image node_id 2 for calling a global function with example usage: _get_improvement_info(study, get_error, improvement_evaluator, error_evaluator) and returns: _ImprovementInfo, _ImprovementInfo