code: def ces_target_fn(
      optimal_param,
      init_alpha_0,
      init_alpha_1,
      init_beta_0,
      init_beta_1,
      opt_alpha_0,
      opt_alpha_1,
      opt_beta_0,
      opt_beta_1,
      y,
      m,
      init_states,
      n_components,
      seasontype,
      nmse,
  ):
      states = np.zeros(
          (len(y) + 2 * m, n_components), dtype=np.float32
      )
      states[:m] = init_states
      j = 0
      if opt_alpha_0:
          alpha_0 = optimal_param[j]
          j += 1
      else:
          alpha_0 = init_alpha_0
  
      if opt_alpha_1:
          alpha_1 = optimal_param[j]
          j += 1
      else:
          alpha_1 = init_alpha_1
  
      if opt_beta_0:
          beta_0 = optimal_param[j]
          j += 1
      else:
          beta_0 = init_beta_0
  
      if opt_beta_1:
          beta_1 = optimal_param[j]
          j += 1
      else:
          beta_1 = init_beta_1
  
      e = np.full_like(y, fill_value=np.nan)
      amse = np.full(nmse, fill_value=np.nan)
      lik = cescalc(
          y=y,
          states=states,
          m=m,
          season=switch_ces(seasontype),
          alpha_0=alpha_0,
          alpha_1=alpha_1,
          beta_0=beta_0,
          beta_1=beta_1,
          e=e,
          amse=amse,
          nmse=nmse,
          backfit=1,
      )
      if lik < -1e10:
          lik = -1e10
      if math.isnan(lik):
          lik = -np.inf
      if math.fabs(lik + 99999) < 1e-7:
          lik = -np.inf
      return lik
  
imports: import math
  from typing import Tuple
  import numpy
  from numba import njit
  from statsmodels.tsa.seasonal import seasonal_decompose
  from .ets import restrict_to_bounds, results
  from .utils import CACHE, NOGIL
label_desc: Use image node_id 9 for calling a global function with example usage: ces_target_fn(optimal_param, init_alpha_0, init_alpha_1, init_beta_0, init_beta_1, opt_alpha_0, opt_alpha_1, opt_beta_0, opt_beta_1, y, m, init_states, n_components, seasontype, nmse) and returns: lik