code: def _calculate_wocs(curr_pt, X, X_ind):
      """Calculated the variance of weighted cosine of a point.
      wcos = (<a_curr, b_curr>/((|a_curr|*|b_curr|)^2)
  
      Parameters
      ----------
      curr_pt : numpy array, shape (1, n_features)
          The sample to be calculated.
  
      X : numpy array of shape (n_samples, n_features)
          The training dataset.
  
      X_ind : list
          The valid index of the training data.
  
      Returns
      -------
      cos_angle_var : float
          The variance of cosine angle
  
      """
      wcos_list = []
      curr_pair_inds = list(combinations(X_ind, 2))
      for j, (a_ind, b_ind) in enumerate(curr_pair_inds):
          a = X[a_ind, :]
          b = X[b_ind, :]
  
          # skip if no angle can be formed
          if np.array_equal(a, curr_pt) or np.array_equal(b, curr_pt):
              continue
          # add the weighted cosine to the list
          wcos_list.append(_wcos(curr_pt, a, b))
      return np.var(wcos_list)
  
imports: from __future__ import division
  from __future__ import print_function
  import warnings
  from itertools import combinations
  import numpy
  from numba import njit
  from sklearn.neighbors import KDTree
  from sklearn.neighbors import NearestNeighbors
  from sklearn.utils import check_array
  from sklearn.utils.validation import check_is_fitted
  from .base import BaseDetector
  from ..utils.utility import check_parameter
label_desc: Use image node_id 2 for calling a global function with example usage: _calculate_wocs(curr_pt, X, X_ind) and returns: np