class_docstr: Transfer learning wrapper for estimators.
  
  This is a wrapper for any BaseEstimator (i.e. classifier or regressor) that
  converts extended labels used in Transfer Learning into the usual y array
  to train a classifier/regressor of choice.
  
  Parameters
  ----------
  target_domain : str
      Domain to consider as target.
  estimator : BaseEstimator
      The estimator to apply on matrices. It can be any regressor or
      classifier from pyRiemann.
  domain_weight : None | dict, default=None
      Weights to combine matrices from each domain to train the estimator.
      The dict contains key=domain_name and value=weight_to_assign.
      If None, it uses equal weights.
  
  Notes
  -----
  .. versionadded:: 0.4
class_docstr_tok: ["Transfer","learning","wrapper","for","estimators",".","This","is","a","wrapper","for","any","BaseEstimator","(","i.e",".","classifier","or","regressor",")","that","converts","extended","labels","used","in","Transfer","Learning","into","the","usual","y","array","to","train","a","classifier\/regressor","of","choice",".","Parameters","--","--","--","--","--","target_domain",":","str","Domain","to","consider","as","target",".","estimator",":","BaseEstimator","The","estimator","to","apply","on","matrices",".","It","can","be","any","regressor","or","classifier","from","pyRiemann",".","domain_weight",":","None","|","dict",",","default=None","Weights","to","combine","matrices","from","each","domain","to","train","the","estimator",".","The","dict","contains","key=domain_name","and","value=weight_to_assign",".","If","None",",","it","uses","equal","weights",".","Notes","--","--","-","..","versionadded",":",":","0.4"]
docstr: Fit TLEstimator.
  
  Parameters
  ----------
  X : ndarray, shape (n_matrices, n_channels, n_channels)
      Set of SPD matrices.
  y_enc : ndarray, shape (n_matrices,)
      Extended labels for each matrix.
  
  Returns
  -------
  self : TLEstimator instance
      The TLEstimator instance.
docstr_tok: ["Fit","TLEstimator",".","Parameters","--","--","--","--","--","X",":","ndarray",",","shape","(","n_matrices",",","n_channels",",","n_channels",")","Set","of","SPD","matrices",".","y_enc",":","ndarray",",","shape","(","n_matrices",",",")","Extended","labels","for","each","matrix",".","Returns","--","--","--","-","self",":","TLEstimator","instance","The","TLEstimator","instance","."]
code: def fit(self, X, y_enc):
      """Fit TLEstimator.
  
      Parameters
      ----------
      X : ndarray, shape (n_matrices, n_channels, n_channels)
          Set of SPD matrices.
      y_enc : ndarray, shape (n_matrices,)
          Extended labels for each matrix.
  
      Returns
      -------
      self : TLEstimator instance
          The TLEstimator instance.
      """
      if not (
          is_regressor(self.estimator) or is_classifier(self.estimator)
      ):
          raise TypeError(
              "Estimator has to be either a classifier or a regressor."
          )
  
      X_dec, y_dec, domains = decode_domains(X, y_enc)
  
      if is_regressor(self.estimator):
          y_dec = y_dec.astype(float)
  
      if self.domain_weight is not None:
          w = np.zeros(len(X_dec))
          for d in np.unique(domains):
              w[domains == d] = self.domain_weight[d]
      else:
          w = None
  
      if isinstance(self.estimator, Pipeline):
          sample_weight = {}
          for step in self.estimator.steps:
              step_name = step[0]
              sample_weight[step_name + "__sample_weight"] = w
          self.estimator.fit(X_dec, y_dec, **sample_weight)
      else:
          self.estimator.fit(X_dec, y_dec, sample_weight=w)
  
      return self
  
imports: import numpy
  from joblib import Parallel, delayed
  from sklearn.base import BaseEstimator, TransformerMixin, is_classifier, is_regressor
  from sklearn.pipeline import Pipeline
  from sklearn.metrics import accuracy_score, r2_score
  from ..utils.mean import mean_covariance, mean_riemann
  from ..utils.distance import distance
  from ..utils.base import invsqrtm, powm, sqrtm
  from ..utils.geodesic import geodesic
  from ..utils.utils import check_weights
  from ._rotate import _get_rotation_matrix
  from ..classification import MDM, _check_metric
  from ..preprocessing import Whitening
  from ._tools import decode_domains
label_desc: Use image node_id 2 for calling the TLEstimator obj's underlying member method code with example usage: obj.fit(X, y_enc) and returns: self