code: def optimize_theta_target_fn(
      init_par, optimize_params, y, modeltype, nmse
  ):
      x0 = [
          init_par[key] for key, val in optimize_params.items() if val
      ]
      x0 = np.array(x0, dtype=np.float32)
      if not len(x0):
          return
  
      init_level = init_par["initial_smoothed"]
      init_alpha = init_par["alpha"]
      init_theta = init_par["theta"]
  
      opt_level = optimize_params["initial_smoothed"]
      opt_alpha = optimize_params["alpha"]
      opt_theta = optimize_params["theta"]
  
      res = nelder_mead_theta(
          x0,
          args=(
              init_level,
              init_alpha,
              init_theta,
              opt_level,
              opt_alpha,
              opt_theta,
              y,
              modeltype,
              nmse,
          ),
          tol_std=1e-4,
          lower=np.array([-1e10, 0.1, 1.0]),
          upper=np.array([1e10, 0.99, 1e10]),
          max_iter=1_000,
          adaptive=True,
      )
      return res
  
imports: import math
  from typing import Tuple
  import numpy
  from numba import njit
  from scipy.stats import norm
  from statsmodels.tsa.seasonal import seasonal_decompose
  from statsmodels.tsa.stattools import acf
  from .ets import restrict_to_bounds, results
  from .utils import _seasonal_naive, _repeat_val_seas, CACHE, NOGIL
label_desc: Use image node_id 11 for calling a global function with example usage: optimize_theta_target_fn(init_par, optimize_params, y, modeltype, nmse) and returns: res