class_docstr: Random interval segmenter transformer.
  
  Transformer that segments time-series into random intervals with
  random starting points and lengths. Some
  intervals may overlap and may be duplicates.
  
  Parameters
  ----------
  n_intervals : str, int or float
      Number of intervals to generate.
      - If "log", log of m is used where m is length of time series.
      - If "sqrt", sqrt of m is used.
      - If "random", random number of intervals is generated.
      - If int, n_intervals intervals are generated.
      - If float, int(n_intervals * m) is used with n_intervals giving the
      fraction of intervals of the
      time series length.
  
      For all arguments relative to the length of the time series,
      the generated number of intervals is
      always at least 1.
  
      Default is "sqrt".
  
  random_state : int, RandomState instance or None, optional (default=None)
      If int, random_state is the seed used by the random number generator;
      If RandomState instance, random_state is the random number generator;
      If None, the random number generator is the RandomState instance used
      by `np.random`.
class_docstr_tok: ["Random","interval","segmenter","transformer",".","Transformer","that","segments","time-series","into","random","intervals","with","random","starting","points","and","lengths",".","Some","intervals","may","overlap","and","may","be","duplicates",".","Parameters","--","--","--","--","--","n_intervals",":","str",",","int","or","float","Number","of","intervals","to","generate",".","-","If","``","log","''",",","log","of","m","is","used","where","m","is","length","of","time","series",".","-","If","``","sqrt","''",",","sqrt","of","m","is","used",".","-","If","``","random","''",",","random","number","of","intervals","is","generated",".","-","If","int",",","n_intervals","intervals","are","generated",".","-","If","float",",","int","(","n_intervals","*","m",")","is","used","with","n_intervals","giving","the","fraction","of","intervals","of","the","time","series","length",".","For","all","arguments","relative","to","the","length","of","the","time","series",",","the","generated","number","of","intervals","is","always","at","least","1",".","Default","is","``","sqrt","''",".","random_state",":","int",",","RandomState","instance","or","None",",","optional","(","default=None",")","If","int",",","random_state","is","the","seed","used","by","the","random","number","generator",";","If","RandomState","instance",",","random_state","is","the","random","number","generator",";","If","None",",","the","random","number","generator","is","the","RandomState","instance","used","by","`","np.random","`","."]
docstr: Fit transformer, generating random interval indices.
  
  Parameters
  ----------
  X : nested pandas DataFrame of shape [n_instances, n_features]
      each cell of X must contain pandas.Series
      Data to fit transform to
  y : any container with method shape, optional, default=None
      y.shape[0] determines n_timepoints, 1 if None
  
  Returns
  -------
  self : RandomIntervalSegmenter
      This estimator
docstr_tok: ["Fit","transformer",",","generating","random","interval","indices",".","Parameters","--","--","--","--","--","X",":","nested","pandas","DataFrame","of","shape","[","n_instances",",","n_features","]","each","cell","of","X","must","contain","pandas.Series","Data","to","fit","transform","to","y",":","any","container","with","method","shape",",","optional",",","default=None","y.shape","[","0","]","determines","n_timepoints",",","1","if","None","Returns","--","--","--","-","self",":","RandomIntervalSegmenter","This","estimator"]
code: def _fit(self, X, y=None):
      """Fit transformer, generating random interval indices.
  
      Parameters
      ----------
      X : nested pandas DataFrame of shape [n_instances, n_features]
          each cell of X must contain pandas.Series
          Data to fit transform to
      y : any container with method shape, optional, default=None
          y.shape[0] determines n_timepoints, 1 if None
  
      Returns
      -------
      self : RandomIntervalSegmenter
          This estimator
      """
      if y is not None:
          n_timepoints = y.shape[0]
      else:
          n_timepoints = 1
  
      self.min_length = check_window_length(
          self.min_length, n_timepoints, "min_length"
      )
      self.max_length = check_window_length(
          self.max_length, n_timepoints, "max_length"
      )
      if self.min_length is None:
          min_length = 2
      else:
          min_length = self.min_length
      if self.max_length is not None:
          if not min_length < self.max_length:
              raise ValueError(
                  "`max_length` must be bigger than `min_length`."
              )
  
      # Retrieve time-series indexes from each column.
      # TODO generalise to columns with series of unequal length
      self._time_index = get_time_index(X)
  
      # Compute random intervals for each column.
      # TODO if multiple columns are passed, introduce option to compute
      #  one set of shared intervals,
      #  or rely on ColumnTransformer?
      if self.n_intervals == "random":
          if self.min_length is not None or self.max_length is not None:
              raise ValueError(
                  "Setting `min_length` or `max_length` is not yet "
                  "implemented for `n_intervals='random'`."
              )
          rand_intervals = _rand_intervals_rand_n(
              self._time_index, random_state=self.random_state
          )
      else:
          rand_intervals = _rand_intervals_fixed_n(
              self._time_index,
              n_intervals=self.n_intervals,
              min_length=min_length,
              max_length=self.max_length,
              random_state=self.random_state,
          )
      self.intervals_ = np.unique(rand_intervals, axis=0)
  
      self.interval_segmenter_ = IntervalSegmenter(self.intervals_)
      self.interval_segmenter_.fit(X=X, y=y)
  
      return self
  
imports: import math
  import numpy
  import pandas
  from sklearn.utils import check_random_state
  from sktime.datatypes._utilities import get_time_index
  from sktime.transformations._delegate import _DelegatedTransformer
  from sktime.transformations.base import BaseTransformer
  from sktime.utils.validation import check_window_length
label_desc: Use image node_id 2 for calling the RandomIntervalSegmenter obj's underlying member method code with example usage: obj._fit(X, y) and returns: self