code: def _nnmark(I):
      """
      Count the number of nearest neighbor overhead crossings or arcs.
  
      Parameters
      ----------
      I : numpy.ndarray
          Matrix profile indices
  
      Returns
      -------
      nnmark : numpy.ndarray
          Counts of nearest neighbor overheard crossings or arcs.
  
      Notes
      -----
      DOI: 10.1109/ICDM.2017.21 <https://www.cs.ucr.edu/~eamonn/Segmentation_ICDM.pdf>`__
  
      See Table I
  
      This is a fast and vectorized implementation of the nnmark algorithm.
      """
      I = I.astype(np.int64)
  
      # Replace index values that are less than zero with its own positional index
      idx = np.argwhere(I < 0).flatten()
      I[idx] = idx
  
      k = I.shape[0]
      i = np.arange(k, dtype=np.int64)
  
      nnmark = np.bincount(np.minimum(i, I), minlength=k)
      nnmark -= np.bincount(np.maximum(i, I), minlength=k)
  
      return nnmark.cumsum()
  
file_path: stumpy/stumpy/floss.py
imports: import copy
  import numpy
  import scipy.stats
  from .None import config, core
label_desc: Use image node_id 1 for calling a global function with example usage: _nnmark(I) and returns: nnmark