class_docstr: Generate algorithms for the Optuna to automate hyperparameter tuning. Please refer to NNI and Optuna
  (https://optuna.readthedocs.io/en/stable/) for more information. Optuna has different running scheme
  compared to NNI. The hyperparameter samples come from a trial object (trial.suggest...) created by Optuna,
  so OptunaGen needs to accept this trial object as input. Meanwhile, Optuna calls OptunaGen,
  thus OptunaGen.__call__() should return the accuracy. Use functools.partial to wrap OptunaGen
  for addition input arguments.
  
  Args:
      algo: an Algo object (e.g. BundleAlgo). The object must at least define two methods: get_output_path and train
          and supports saving to and loading from pickle files via ``algo_from_pickle`` and ``algo_to_pickle``.
      params: a set of parameter to override the algo if override is supported by Algo subclass.
  
  Examples::
  
      The experiment will keep generating new folders to save the model checkpoints, scripts, and configs if available.
      ├── algorithm_templates
      │   └── unet
      ├── unet_0
      │   ├── algo_object.pkl
      │   ├── configs
      │   └── scripts
      ├── unet_0_learning_rate_0.01
      │   ├── algo_object.pkl
      │   ├── configs
      │   ├── model_fold0
      │   └── scripts
      └── unet_0_learning_rate_0.1
          ├── algo_object.pkl
          ├── configs
          ├── model_fold0
          └── scripts
  
  Notes:
      Different from NNI and NNIGen, OptunaGen and Optuna can be ran within the Python process.
docstr: Get parameter for next round of training from optuna trial object.
  This function requires user rewrite during usage for different search space.
docstr_tok: ["Get","parameter","for","next","round","of","training","from","optuna","trial","object",".","This","function","requires","user","rewrite","during","usage","for","different","search","space","."]
code: def get_hyperparameters(self):
      """
      Get parameter for next round of training from optuna trial object.
      This function requires user rewrite during usage for different search space.
      """
      if has_optuna:
          logger.info(
              "Please rewrite this code by creating a child class"
          )
          return {
              "learning_rate": self.trial.suggest_float(
                  "learning_rate", 0.0001, 0.1
              )
          }
      else:
          warn(
              "Optuna is not detected. The code will continue to run without Optuna."
          )
          return {}
  
imports: from __future__ import annotations
  import os
  from abc import abstractmethod
  from copy import deepcopy
  from typing import Any, cast
  from warnings import warn
  from monai.apps.auto3dseg.bundle_gen import BundleAlgo
  from monai.apps.utils import get_logger
  from monai.auto3dseg import Algo, AlgoGen, algo_from_pickle, algo_to_pickle
  from monai.bundle.config_parser import ConfigParser
  from monai.config import PathLike
  from monai.utils import optional_import
  from monai.utils.enums import AlgoKeys
label_desc: Use image node_id 3 for calling the OptunaGen obj's underlying member method code with example usage: obj.get_hyperparameters() and returns: dict, dict