code: def expected_minimum(res, n_random_starts=20, random_state=None):
      """Compute the minimum over the predictions of the last surrogate model.
      Uses `expected_minimum_random_sampling` with `n_random_starts` = 100000,
      when the space contains any categorical values.
  
      .. note::
          The returned minimum may not necessarily be an accurate
          prediction of the minimum of the true objective function.
  
      Parameters
      ----------
      res : `OptimizeResult`, scipy object
          The optimization result returned by a `skopt` minimizer.
  
      n_random_starts : int, default=20
          The number of random starts for the minimization of the surrogate
          model.
  
      random_state : int, RandomState instance, or None (default)
          Set random state to something other than None for reproducible
          results.
  
      Returns
      -------
      x : list
          location of the minimum.
      fun : float
          the surrogate function value at the minimum.
      """
      if res.space.is_partly_categorical:
          return expected_minimum_random_sampling(
              res, n_random_starts=100000, random_state=random_state
          )
  
      def func(x):
          reg = res.models[-1]
          x = res.space.transform(x.reshape(1, -1))
          return reg.predict(x.reshape(1, -1))[0]
  
      xs = [res.x]
      if n_random_starts > 0:
          xs.extend(
              res.space.rvs(n_random_starts, random_state=random_state)
          )
  
      best_x = None
      best_fun = np.inf
  
      for x0 in xs:
          r = sp_minimize(func, x0=x0, bounds=res.space.bounds)
  
          if r.fun < best_fun:
              best_x = r.x
              best_fun = r.fun
  
      return [v for v in best_x], best_fun
  
imports: from copy import deepcopy
  from functools import wraps
  from sklearn.utils import check_random_state
  import numpy
  from scipy.optimize import OptimizeResult
  from scipy.optimize import minimize
  from sklearn.base import is_regressor
  from sklearn.ensemble import GradientBoostingRegressor
  from joblib import dump
  from joblib import load
  from collections import OrderedDict
  from .learning import ExtraTreesRegressor
  from .learning import GaussianProcessRegressor
  from .learning import GradientBoostingQuantileRegressor
  from .learning import RandomForestRegressor
  from .learning.gaussian_process.kernels import ConstantKernel
  from .learning.gaussian_process.kernels import HammingKernel
  from .learning.gaussian_process.kernels import Matern
  from .sampler import Sobol, Lhs, Hammersly, Halton, Grid
  from .sampler import InitialPointGenerator
  from .space import Space, Categorical, Integer, Real, Dimension
label_desc: Use image node_id 8 for calling a global function with example usage: expected_minimum(res, n_random_starts, random_state) and returns: unknown,  best_fun, expected_minimum_random_sampling, reg