class_docstr: Weighted ensemble of classifiers with fittable ensemble weight.
  
  Produces a probabilistic prediction which is the weighted average of
  predictions of individual classifiers.
  Classifier with name `name` has ensemble weight in `weights_[name]`.
  `weights_` is fitted in `fit`, if `weights` is a scalar, otherwise fixed.
  
  If `weights` is a scalar, empirical training loss is computed for each classifier.
  In this case, ensemble weights of classifier is empirical loss,
  to the power of `weights` (a scalar).
  
  The evaluation for the empirical training loss can be selected
  through the `metric` and `metric_type` parameters.
  
  The in-sample empirical training loss is computed in-sample or out-of-sample,
  depending on the `cv` parameter. None = in-sample; other = cross-validated oos.
  
  Parameters
  ----------
  classifiers : dict or None, default=None
      Parameters for the ShapeletTransformClassifier module. If None, uses the
      default parameters with a 2 hour transform contract.
  weights : float, or iterable of float, optional, default=None
      if float, ensemble weight for classifier i will be train score to this power
      if iterable of float, must be equal length as classifiers
          ensemble weight for classifier i will be weights[i]
      if None, ensemble weights are equal (uniform average)
  cv : None, int, or sklearn cross-validation object, optional, default=None
      determines whether in-sample or which cross-validated predictions used in fit
      None : predictions are in-sample, equivalent to fit(X, y).predict(X)
      cv : predictions are equivalent to fit(X_train, y_train).predict(X_test)
          where multiple X_train, y_train, X_test are obtained from cv folds
          returned y is union over all test fold predictions
          cv test folds must be non-intersecting
      int : equivalent to cv=KFold(cv, shuffle=True, random_state=x),
          i.e., k-fold cross-validation predictions out-of-sample
          random_state x is taken from self if exists, otherwise x=None
  metric : sklearn metric for computing training score, default=accuracy_score
      only used if weights is a float
  metric_type : str, one of "point" or "proba", default="point"
      type of sklearn metric, point prediction ("point") or probabilistic ("proba")
      if "point", most probable class is passed as y_pred
      if "proba", probability of most probable class is passed as y_pred
  random_state : int or None, default=None
      Seed for random number generation.
  
  Attributes
  ----------
  classifiers_ : list of tuples (str, classifier) of sktime classifiers
      clones of classifies in `classifiers` which are fitted in the ensemble
      is always in (str, classifier) format, even if `classifiers` is just a list
      strings not passed in `classifiers` are replaced by unique generated strings
      i-th classifier in `classifier_` is clone of i-th in `classifier`
  weights_ : dict with str being classifier names as in `classifiers_`
      value at key is ensemble weights of classifier with name key
      ensemble weights are fitted in `fit` if `weights` is a scalar
  
  Examples
  --------
  >>> from sktime.classification.dummy import DummyClassifier
  >>> from sktime.classification.kernel_based import RocketClassifier
  >>> from sktime.datasets import load_unit_test
  >>> X_train, y_train = load_unit_test(split="train") # doctest: +SKIP
  >>> X_test, y_test = load_unit_test(split="test") # doctest: +SKIP
  >>> clf = WeightedEnsembleClassifier(
  ...     [DummyClassifier(), RocketClassifier(num_kernels=100)],
  ...     weights=2,
  ... ) # doctest: +SKIP
  >>> clf.fit(X_train, y_train) # doctest: +SKIP
  WeightedEnsembleClassifier(...)
  >>> y_pred = clf.predict(X_test) # doctest: +SKIP
class_docstr_tok: ["Weighted","ensemble","of","classifiers","with","fittable","ensemble","weight",".","Produces","a","probabilistic","prediction","which","is","the","weighted","average","of","predictions","of","individual","classifiers",".","Classifier","with","name","`","name","`","has","ensemble","weight","in","`","weights_","[","name","]","`",".","`","weights_","`","is","fitted","in","`","fit","`",",","if","`","weights","`","is","a","scalar",",","otherwise","fixed",".","If","`","weights","`","is","a","scalar",",","empirical","training","loss","is","computed","for","each","classifier",".","In","this","case",",","ensemble","weights","of","classifier","is","empirical","loss",",","to","the","power","of","`","weights","`","(","a","scalar",")",".","The","evaluation","for","the","empirical","training","loss","can","be","selected","through","the","`","metric","`","and","`","metric_type","`","parameters",".","The","in-sample","empirical","training","loss","is","computed","in-sample","or","out-of-sample",",","depending","on","the","`","cv","`","parameter",".","None","=","in-sample",";","other","=","cross-validated","oos",".","Parameters","--","--","--","--","--","classifiers",":","dict","or","None",",","default=None","Parameters","for","the","ShapeletTransformClassifier","module",".","If","None",",","uses","the","default","parameters","with","a","2","hour","transform","contract",".","weights",":","float",",","or","iterable","of","float",",","optional",",","default=None","if","float",",","ensemble","weight","for","classifier","i","will","be","train","score","to","this","power","if","iterable","of","float",",","must","be","equal","length","as","classifiers","ensemble","weight","for","classifier","i","will","be","weights","[","i","]","if","None",",","ensemble","weights","are","equal","(","uniform","average",")","cv",":","None",",","int",",","or","sklearn","cross-validation","object",",","optional",",","default=None","determines","whether","in-sample","or","which","cross-validated","predictions","used","in","fit","None",":","predictions","are","in-sample",",","equivalent","to","fit","(","X",",","y",")",".predict","(","X",")","cv",":","predictions","are","equivalent","to","fit","(","X_train",",","y_train",")",".predict","(","X_test",")","where","multiple","X_train",",","y_train",",","X_test","are","obtained","from","cv","folds","returned","y","is","union","over","all","test","fold","predictions","cv","test","folds","must","be","non-intersecting","int",":","equivalent","to","cv=KFold","(","cv",",","shuffle=True",",","random_state=x",")",",","i.e.",",","k-fold","cross-validation","predictions","out-of-sample","random_state","x","is","taken","from","self","if","exists",",","otherwise","x=None","metric",":","sklearn","metric","for","computing","training","score",",","default=accuracy_score","only","used","if","weights","is","a","float","metric_type",":","str",",","one","of","``","point","''","or","``","proba","''",",","default=","''","point","''","type","of","sklearn","metric",",","point","prediction","(","``","point","''",")","or","probabilistic","(","``","proba","''",")","if","``","point","''",",","most","probable","class","is","passed","as","y_pred","if","``","proba","''",",","probability","of","most","probable","class","is","passed","as","y_pred","random_state",":","int","or","None",",","default=None","Seed","for","random","number","generation",".","Attributes","--","--","--","--","--","classifiers_",":","list","of","tuples","(","str",",","classifier",")","of","sktime","classifiers","clones","of","classifies","in","`","classifiers","`","which","are","fitted","in","the","ensemble","is","always","in","(","str",",","classifier",")","format",",","even","if","`","classifiers","`","is","just","a","list","strings","not","passed","in","`","classifiers","`","are","replaced","by","unique","generated","strings","i-th","classifier","in","`","classifier_","`","is","clone","of","i-th","in","`","classifier","`","weights_",":","dict","with","str","being","classifier","names","as","in","`","classifiers_","`","value","at","key","is","ensemble","weights","of","classifier","with","name","key","ensemble","weights","are","fitted","in","`","fit","`","if","`","weights","`","is","a","scalar","Examples","--","--","--","--",">",">",">","from","sktime.classification.dummy","import","DummyClassifier",">",">",">","from","sktime.classification.kernel_based","import","RocketClassifier",">",">",">","from","sktime.datasets","import","load_unit_test",">",">",">","X_train",",","y_train","=","load_unit_test","(","split=","''","train","''",")","#","doctest",":","+SKIP",">",">",">","X_test",",","y_test","=","load_unit_test","(","split=","''","test","''",")","#","doctest",":","+SKIP",">",">",">","clf","=","WeightedEnsembleClassifier","(","...","[","DummyClassifier","(",")",",","RocketClassifier","(","num_kernels=100",")","]",",","...","weights=2",",","...",")","#","doctest",":","+SKIP",">",">",">","clf.fit","(","X_train",",","y_train",")","#","doctest",":","+SKIP","WeightedEnsembleClassifier","(","...",")",">",">",">","y_pred","=","clf.predict","(","X_test",")","#","doctest",":","+SKIP"]
docstr: Predicts labels probabilities for sequences in X.
  
  Parameters
  ----------
  X : 3D np.array of shape = [n_instances, n_dimensions, series_length]
      The data to make predict probabilities for.
  
  Returns
  -------
  y : array-like, shape = [n_instances, n_classes_]
      Predicted probabilities using the ordering in classes_.
docstr_tok: ["Predicts","labels","probabilities","for","sequences","in","X.","Parameters","--","--","--","--","--","X",":","3D","np.array","of","shape","=","[","n_instances",",","n_dimensions",",","series_length","]","The","data","to","make","predict","probabilities","for",".","Returns","--","--","--","-","y",":","array-like",",","shape","=","[","n_instances",",","n_classes_","]","Predicted","probabilities","using","the","ordering","in","classes_","."]
code: def _predict_proba(self, X) -> np.ndarray:
      """Predicts labels probabilities for sequences in X.
  
      Parameters
      ----------
      X : 3D np.array of shape = [n_instances, n_dimensions, series_length]
          The data to make predict probabilities for.
  
      Returns
      -------
      y : array-like, shape = [n_instances, n_classes_]
          Predicted probabilities using the ordering in classes_.
      """
      dists = None
  
      # Call predict proba on each classifier, multiply the probabilities by the
      # classifiers weight then add them to the current HC2 probabilities
      for clf_name, clf in self.classifiers_:
          y_proba = clf.predict_proba(X=X)
          if dists is None:
              dists = y_proba * self.weights_[clf_name]
          else:
              dists += y_proba * self.weights_[clf_name]
  
      # Make each instances probability array sum to 1 and return
      y_proba = dists / dists.sum(axis=1, keepdims=True)
  
      return y_proba
  
file_path: sktime/sktime/classification/ensemble/_weighted.py
imports: import numpy
  from sklearn.metrics import accuracy_score
  from sktime.base import _HeterogenousMetaEstimator
  from sktime.classification.base import BaseClassifier
label_desc: Use image node_id 5 for calling the WeightedEnsembleClassifier obj's underlying member method code with example usage: obj._predict_proba(X) and returns: y_proba