code: def select_vmm_cv(
      krange,
      precision,
      x,
      null_class,
      cv_index,
      ninit=5,
      maxiter=100,
      bias=None,
      verbose=0,
  ):
      """Return the best von_mises mixture after severla initialization
  
      Parameters
      ----------
      krange: list of ints,
              number of classes to consider
      precision: float,
                 precision parameter of the von-mises densities
      x: array of shape(n, 3)
         should be on the unit sphere
      null class: bool, whether a null class should be included or not
      cv_index: set of indices for cross validation
      ninit: int, optional,
             number of iterations
      maxiter: int, optional,
      bias: array of shape (n), prior
      """
      score = -np.inf
      mll = []
      for k in krange:
          mll.append(-np.inf)
          for j in range(1):
              ll = np.zeros_like(cv_index).astype(np.float64)
              for i in np.unique(cv_index):
                  xl = x[cv_index != i]
                  xt = x[cv_index == i]
                  bias_l = None
                  if bias is not None:
                      bias_l = bias[cv_index != i]
                  aux = estimate_robust_vmm(
                      k,
                      precision,
                      null_class,
                      xl,
                      ninit=ninit,
                      bias=bias_l,
                      maxiter=maxiter,
                  )
                  if bias is None:
                      ll[cv_index == i] = np.log(
                          aux.mixture_density(xt)
                      )
                  else:
                      bias_t = bias[cv_index == i]
                      lwd = aux.weighted_density(xt)
                      ll[cv_index == i] = np.log(
                          lwd[:, 0] * (1 - bias_t)
                          + lwd[:, 1:].sum(1) * bias_t
                      )
              if ll.mean() > mll[-1]:
                  mll[-1] = ll.mean()
  
          aux = estimate_robust_vmm(
              k,
              precision,
              null_class,
              x,
              ninit,
              bias=bias,
              maxiter=maxiter,
          )
  
          if verbose:
              print(k, mll[-1])
          if mll[-1] > score:
              best_model = aux
              score = mll[-1]
  
      return best_model
  
imports: from warnings import warn
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: select_vmm_cv(krange, precision, x, null_class, cv_index, ninit, maxiter, bias, verbose) and returns: best_model