class_docstr: Arsenal ensemble.
  
  Overview: an ensemble of ROCKET transformers using RidgeClassifierCV base
  classifier. Weights each classifier using the accuracy from the ridge
  cross-validation. Allows for generation of probability estimates at the
  expense of scalability compared to RocketClassifier.
  
  Parameters
  ----------
  num_kernels : int, default=2,000
      Number of kernels for each ROCKET transform.
  n_estimators : int, default=25
      Number of estimators to build for the ensemble.
  rocket_transform : str, default="rocket"
      The type of Rocket transformer to use.
      Valid inputs = ["rocket","minirocket","multirocket"]
  max_dilations_per_kernel : int, default=32
      MiniRocket and MultiRocket only. The maximum number of dilations per kernel.
  n_features_per_kernel : int, default=4
      MultiRocket only. The number of features per kernel.
  time_limit_in_minutes : int, default=0
      Time contract to limit build time in minutes, overriding n_estimators.
      Default of 0 means n_estimators is used.
  contract_max_n_estimators : int, default=100
      Max number of estimators when time_limit_in_minutes is set.
  save_transformed_data : bool, default=False
      Save the data transformed in fit for use in _get_train_probs.
  n_jobs : int, default=1
      The number of jobs to run in parallel for both `fit` and `predict`.
      ``-1`` means using all processors.
  random_state : int or None, default=None
      Seed for random number generation.
  
  Attributes
  ----------
  n_classes : int
      The number of classes.
  n_instances_ : int
      The number of train cases.
  n_dims_ : int
      The number of dimensions per case.
  series_length_ : int
      The length of each series.
  classes_ : list
      The classes labels.
  estimators_ : list of shape (n_estimators) of BaseEstimator
      The collections of estimators trained in fit.
  weights_ : list of shape (n_estimators) of float
      Weight of each estimator in the ensemble.
  transformed_data_ : list of shape (n_estimators) of ndarray with shape
  (n_instances,total_intervals * att_subsample_size)
      The transformed dataset for all classifiers. Only saved when
      save_transformed_data is true.
  
  See Also
  --------
  RocketClassifier
  
  Notes
  -----
  For the Java version, see
  `TSML <https://github.com/uea-machine-learning/tsml/blob/master/src/main/java
  /tsml/classifiers/kernel_based/Arsenal.java>`_.
  
  References
  ----------
  .. [1] Middlehurst, Matthew, James Large, Michael Flynn, Jason Lines, Aaron Bostrom,
     and Anthony Bagnall. "HIVE-COTE 2.0: a new meta ensemble for time series
     classification." arXiv preprint arXiv:2104.07551 (2021).
  
  Examples
  --------
  >>> from sktime.classification.kernel_based import Arsenal
  >>> from sktime.datasets import load_unit_test
  >>> X_train, y_train = load_unit_test(split="train", return_X_y=True)
  >>> X_test, y_test =load_unit_test(split="test", return_X_y=True) # doctest: +SKIP
  >>> clf = Arsenal(num_kernels=100, n_estimators=5) # doctest: +SKIP
  >>> clf.fit(X_train, y_train) # doctest: +SKIP
  Arsenal(...)
  >>> y_pred = clf.predict(X_test) # doctest: +SKIP
docstr: Fit Arsenal to training data.
  
  Parameters
  ----------
  X : 3D np.array of shape = [n_instances, n_dimensions, series_length]
      The training data.
  y : array-like, shape = [n_instances]
      The class labels.
  
  Returns
  -------
  self :
      Reference to self.
  
  Notes
  -----
  Changes state by creating a fitted model that updates attributes
  ending in "_" and sets is_fitted flag to True.
docstr_tok: ["Fit","Arsenal","to","training","data",".","Parameters","--","--","--","--","--","X",":","3D","np.array","of","shape","=","[","n_instances",",","n_dimensions",",","series_length","]","The","training","data",".","y",":","array-like",",","shape","=","[","n_instances","]","The","class","labels",".","Returns","--","--","--","-","self",":","Reference","to","self",".","Notes","--","--","-","Changes","state","by","creating","a","fitted","model","that","updates","attributes","ending","in","``","_","''","and","sets","is_fitted","flag","to","True","."]
code: def _fit(self, X, y):
      """Fit Arsenal to training data.
  
      Parameters
      ----------
      X : 3D np.array of shape = [n_instances, n_dimensions, series_length]
          The training data.
      y : array-like, shape = [n_instances]
          The class labels.
  
      Returns
      -------
      self :
          Reference to self.
  
      Notes
      -----
      Changes state by creating a fitted model that updates attributes
      ending in "_" and sets is_fitted flag to True.
      """
      self.n_instances_, self.n_dims_, self.series_length_ = X.shape
      time_limit = self.time_limit_in_minutes * 60
      start_time = time.time()
      train_time = 0
  
      if self.rocket_transform == "rocket":
          base_rocket = Rocket(num_kernels=self.num_kernels)
      elif self.rocket_transform == "minirocket":
          if self.n_dims_ > 1:
              base_rocket = MiniRocketMultivariate(
                  num_kernels=self.num_kernels,
                  max_dilations_per_kernel=self.max_dilations_per_kernel,
              )
          else:
              base_rocket = MiniRocket(
                  num_kernels=self.num_kernels,
                  max_dilations_per_kernel=self.max_dilations_per_kernel,
              )
      elif self.rocket_transform == "multirocket":
          if self.n_dims_ > 1:
              base_rocket = MultiRocketMultivariate(
                  num_kernels=self.num_kernels,
                  max_dilations_per_kernel=self.max_dilations_per_kernel,
                  n_features_per_kernel=self.n_features_per_kernel,
              )
          else:
              base_rocket = MultiRocket(
                  num_kernels=self.num_kernels,
                  max_dilations_per_kernel=self.max_dilations_per_kernel,
                  n_features_per_kernel=self.n_features_per_kernel,
              )
      else:
          raise ValueError(
              f"Invalid Rocket transformer: {self.rocket_transform}"
          )
  
      if time_limit > 0:
          self.n_estimators = 0
          self.estimators_ = []
          self.transformed_data_ = []
  
          while (
              train_time < time_limit
              and self.n_estimators < self.contract_max_n_estimators
          ):
              fit = Parallel(n_jobs=self._threads_to_use)(
                  delayed(self._fit_estimator)(
                      _clone_estimator(
                          base_rocket,
                          None
                          if self.random_state is None
                          else (
                              255
                              if self.random_state == 0
                              else self.random_state
                          )
                          * 37
                          * (i + 1)
                          % 2**31,
                      ),
                      X,
                      y,
                  )
                  for i in range(self._threads_to_use)
              )
  
              estimators, transformed_data = zip(*fit)
  
              self.estimators_ += estimators
              self.transformed_data_ += transformed_data
  
              self.n_estimators += self._threads_to_use
              train_time = time.time() - start_time
      else:
          fit = Parallel(n_jobs=self._threads_to_use)(
              delayed(self._fit_estimator)(
                  _clone_estimator(
                      base_rocket,
                      None
                      if self.random_state is None
                      else (
                          255
                          if self.random_state == 0
                          else self.random_state
                      )
                      * 37
                      * (i + 1)
                      % 2**31,
                  ),
                  X,
                  y,
              )
              for i in range(self.n_estimators)
          )
  
          self.estimators_, self.transformed_data_ = zip(*fit)
  
      self.weights_ = []
      self._weight_sum = 0
      for rocket_pipeline in self.estimators_:
          weight = rocket_pipeline.steps[2][1].best_score_
          self.weights_.append(weight)
          self._weight_sum += weight
  
      return self
  
imports: import time
  import numpy
  from joblib import Parallel, delayed
  from sklearn.linear_model import RidgeClassifierCV
  from sklearn.pipeline import make_pipeline
  from sklearn.preprocessing import StandardScaler
  from sklearn.utils import check_random_state
  from sktime.base._base import _clone_estimator
  from sktime.classification.base import BaseClassifier
  from sktime.transformations.panel.rocket import MiniRocket, MiniRocketMultivariate, MultiRocket, MultiRocketMultivariate, Rocket
  from sktime.utils.validation.panel import check_X_y
label_desc: Use image node_id 2 for calling the Arsenal obj's underlying member method code with example usage: obj._fit(X, y) and returns: self