code: def _segmentation(
      X, clasp, n_change_points=None, exclusion_radius=0.05
  ):
      """Segments the time series by extracting change points.
  
      Parameters
      ----------
      X : array-like, shape=[n]
          the univariate time series of length n to be segmented
      clasp :
          the transformer
      n_change_points : int
          the number of change points to find
      exclusion_radius :
          the exclusion zone
  
      Returns
      -------
      Tuple (array-like, array-like, array-like):
          (predicted_change_points, clasp_profiles, scores)
      """
      period_size = clasp.window_length
      queue = PriorityQueue()
  
      # compute global clasp
      profile = clasp.transform(X)
      queue.put(
          (
              -np.max(profile),
              [
                  np.arange(X.shape[0]).tolist(),
                  np.argmax(profile),
                  profile,
              ],
          )
      )
  
      profiles = []
      change_points = []
      scores = []
  
      for idx in range(n_change_points):
          # should not happen ... safety first
          if queue.empty() is True:
              break
  
          # get profile with highest change point score
          priority, (
              profile_range,
              change_point,
              full_profile,
          ) = queue.get()
  
          change_points.append(change_point)
          scores.append(-priority)
          profiles.append(full_profile)
  
          if idx == n_change_points - 1:
              break
  
          # create left and right local range
          left_range = np.arange(
              profile_range[0], change_point
          ).tolist()
          right_range = np.arange(
              change_point, profile_range[-1]
          ).tolist()
  
          for ranges in [left_range, right_range]:
              # create and enqueue left local profile
              if len(ranges) > period_size:
                  profile = clasp.transform(X[ranges])
                  change_point = np.argmax(profile)
                  score = profile[change_point]
  
                  full_profile = np.zeros(len(X))
                  full_profile.fill(0.5)
                  np.copyto(
                      full_profile[
                          ranges[0] : ranges[0] + len(profile)
                      ],
                      profile,
                  )
  
                  global_change_point = ranges[0] + change_point
  
                  if not _is_trivial_match(
                      global_change_point,
                      change_points,
                      X.shape[0],
                      exclusion_radius=exclusion_radius,
                  ):
                      queue.put(
                          (
                              -score,
                              [
                                  ranges,
                                  global_change_point,
                                  full_profile,
                              ],
                          )
                      )
  
      return (
          np.array(change_points),
          np.array(profiles, dtype=object),
          np.array(scores),
      )
  
file_path: sktime/sktime/annotation/clasp.py
imports: from sktime.annotation.base import BaseSeriesAnnotator
  from queue import PriorityQueue
  import numpy
  import pandas
  from sktime.transformations.series.clasp import ClaSPTransformer
  from sktime.utils.validation.series import check_series
label_desc: Use image node_id 3 for calling a global function with example usage: _segmentation(X, clasp, n_change_points, exclusion_radius) and returns: np,  np,  np