class_docstr: Base class for forests of trees.
docstr: Compute feature importances for time series forest.
docstr_tok: ["Compute","feature","importances","for","time","series","forest","."]
code: def feature_importances_(self, normalise_time_points=False):
      """Compute feature importances for time series forest."""
      # assumes particular structure of clf,
      # with each tree consisting of a particular pipeline,
      # as in modular tsf
  
      if not isinstance(
          self.estimators_[0].steps[0][1],
          RandomIntervalFeatureExtractor,
      ):
          raise NotImplementedError(
              "RandomIntervalFeatureExtractor must"
              " be used as the transformer,"
              " which must be the first step"
              " in the base estimator."
          )
  
      # get series length, assuming same length series
      tree = self.estimators_[0]
      transformer = tree.steps[0][1]
      time_index = transformer._time_index
      n_timepoints = len(time_index)
  
      # get feature names, features are the same for all trees
      feature_names = [
          feature.__name__ for feature in transformer.features
      ]
      n_features = len(feature_names)
  
      # get intervals from transformer,
      # the number of intervals is the same for all trees
  
      intervals = transformer.intervals_
      n_intervals = len(intervals)
  
      # get number of estimators
      n_estimators = len(self.estimators_)
  
      # preallocate array for feature importances
      fis = np.zeros((n_timepoints, n_features))
      if normalise_time_points:
          fis_count = np.zeros((n_timepoints, n_features))
  
      for i in range(n_estimators):
          # select tree
          tree = self.estimators_[i]
          transformer = tree.steps[0][1]
          classifier = tree.steps[-1][1]
  
          # get intervals from transformer
          intervals = transformer.intervals_
  
          # get feature importances from classifier
          fi = classifier.feature_importances_
  
          for k in range(n_features):
              for j in range(n_intervals):
                  # get start and end point from interval
                  start, end = intervals[j]
  
                  # get time index for interval
                  interval_time_points = np.arange(start, end)
  
                  # get index for feature importances,
                  # assuming particular order of features
  
                  column_index = (k * n_intervals) + j
  
                  # add feature importance for all time points of interval
                  fis[interval_time_points, k] += fi[column_index]
                  if normalise_time_points:
                      fis_count[interval_time_points, k] += 1
  
      # normalise by number of estimators and number of intervals
      fis = fis / n_estimators / n_intervals
  
      # format output
      fis = pd.DataFrame(fis, columns=feature_names, index=time_index)
  
      if normalise_time_points:
          fis_count = fis_count / n_estimators / n_intervals
          fis_count = pd.DataFrame(
              fis_count, columns=feature_names, index=time_index
          )
          fis /= fis_count
  
      return fis
  
imports: from abc import abstractmethod
  from warnings import catch_warnings, simplefilter
  import numpy
  import pandas
  from joblib import Parallel, delayed
  from numpy import float64
  from sklearn.base import clone
  from sklearn.ensemble._forest import MAX_INT, BaseForest, _generate_sample_indices, _get_n_samples_bootstrap
  from sklearn.exceptions import DataConversionWarning
  from sklearn.utils import check_array, check_random_state, compute_sample_weight
  from sktime.transformations.panel.summarize import RandomIntervalFeatureExtractor
  from sktime.utils.random_state import set_random_state
  from sktime.utils.warnings import warn
label_desc: Use image node_id 7 for calling the BaseTimeSeriesForest obj's underlying member method code with example usage: obj.feature_importances_(normalise_time_points) and returns: fis