class_docstr: Classification by Minimum Distance to Weighted Mean.
  
  Classification by nearest centroid. For each of the given classes, a
  centroid is estimated, according to the chosen metric, as a weighted mean
  of SPD matrices from the source domain, combined with the class centroid of
  the target domain [1]_ [2]_.
  For classification, a given new matrix is attibuted to the class whose
  centroid is the nearest according to the chosen metric.
  
  Parameters
  ----------
  domain_tradeoff : float
      Coefficient in [0,1] controlling the transfer, ie the trade-off between
      source and target domains.
      At 0, there is no transfer, only matrices acquired from the source
      domain are used.
      At 1, this is a calibration-free system as no matrices are required
      from the source domain.
  target_domain : string
      Name of the target domain in extended labels.
  metric : string | dict, default='riemann'
      The type of metric used for centroid and distance estimation.
      see `mean_covariance` for the list of supported metric.
      the metric could be a dict with two keys, `mean` and `distance` in
      order to pass different metric for the centroid estimation and the
      distance estimation. Typical usecase is to pass 'logeuclid' metric for
      the mean in order to boost the computional speed and 'riemann' for the
      distance in order to keep the good sensitivity for the classification.
  n_jobs : int, default=1
      The number of jobs to use for the computation. This works by computing
      each of the class centroid in parallel.
      If -1 all CPUs are used. If 1 is given, no parallel computing code is
      used at all, which is useful for debugging. For n_jobs below -1,
      (n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one
      are used.
  
  Attributes
  ----------
  classes_ : ndarray, shape (n_classes,)
      Labels for each class.
  covmeans_ : list of ``n_classes`` ndarrays of shape (n_channels,             n_channels)
      Centroids for each class.
  
  See Also
  --------
  MDM
  
  References
  ----------
  .. [1] `Transfer learning for SSVEP-based BCI using Riemannian similarities
      between users
      <https://hal.archives-ouvertes.fr/hal-01911092/>`_
      E. Kalunga, S. Chevallier and Q. Barthelemy, in 26th European Signal
      Processing Conference (EUSIPCO), pp. 1685-1689. IEEE, 2018.
  .. [2] `Minimizing Subject-dependent Calibration for BCI with Riemannian
      Transfer Learning
      <https://hal.archives-ouvertes.fr/hal-03202360/>`_
      S. Khazem, S. Chevallier, Q. Barthelemy, K. Haroun and C. Nous, 10th
      International IEEE/EMBS Conference on Neural Engineering (NER), pp.
      523-526. IEEE, 2021.
  
  Notes
  -----
  .. versionadded:: 0.4
class_docstr_tok: ["Classification","by","Minimum","Distance","to","Weighted","Mean",".","Classification","by","nearest","centroid",".","For","each","of","the","given","classes",",","a","centroid","is","estimated",",","according","to","the","chosen","metric",",","as","a","weighted","mean","of","SPD","matrices","from","the","source","domain",",","combined","with","the","class","centroid","of","the","target","domain","[","1","]","_","[","2","]","_",".","For","classification",",","a","given","new","matrix","is","attibuted","to","the","class","whose","centroid","is","the","nearest","according","to","the","chosen","metric",".","Parameters","--","--","--","--","--","domain_tradeoff",":","float","Coefficient","in","[","0,1","]","controlling","the","transfer",",","ie","the","trade-off","between","source","and","target","domains",".","At","0",",","there","is","no","transfer",",","only","matrices","acquired","from","the","source","domain","are","used",".","At","1",",","this","is","a","calibration-free","system","as","no","matrices","are","required","from","the","source","domain",".","target_domain",":","string","Name","of","the","target","domain","in","extended","labels",".","metric",":","string","|","dict",",","default='riemann'","The","type","of","metric","used","for","centroid","and","distance","estimation",".","see","`","mean_covariance","`","for","the","list","of","supported","metric",".","the","metric","could","be","a","dict","with","two","keys",",","`","mean","`","and","`","distance","`","in","order","to","pass","different","metric","for","the","centroid","estimation","and","the","distance","estimation",".","Typical","usecase","is","to","pass","'logeuclid","'","metric","for","the","mean","in","order","to","boost","the","computional","speed","and","'riemann","'","for","the","distance","in","order","to","keep","the","good","sensitivity","for","the","classification",".","n_jobs",":","int",",","default=1","The","number","of","jobs","to","use","for","the","computation",".","This","works","by","computing","each","of","the","class","centroid","in","parallel",".","If","-1","all","CPUs","are","used",".","If","1","is","given",",","no","parallel","computing","code","is","used","at","all",",","which","is","useful","for","debugging",".","For","n_jobs","below","-1",",","(","n_cpus","+","1","+","n_jobs",")","are","used",".","Thus","for","n_jobs","=","-2",",","all","CPUs","but","one","are","used",".","Attributes","--","--","--","--","--","classes_",":","ndarray",",","shape","(","n_classes",",",")","Labels","for","each","class",".","covmeans_",":","list","of","``","n_classes","``","ndarrays","of","shape","(","n_channels",",","n_channels",")","Centroids","for","each","class",".","See","Also","--","--","--","--","MDM","References","--","--","--","--","--","..","[","1","]","`","Transfer","learning","for","SSVEP-based","BCI","using","Riemannian","similarities","between","users","<","https",":","\/\/hal.archives-ouvertes.fr\/hal-01911092\/",">","`","_","E.","Kalunga",",","S.","Chevallier","and","Q.","Barthelemy",",","in","26th","European","Signal","Processing","Conference","(","EUSIPCO",")",",","pp",".","1685-1689",".","IEEE",",","2018",".","..","[","2","]","`","Minimizing","Subject-dependent","Calibration","for","BCI","with","Riemannian","Transfer","Learning","<","https",":","\/\/hal.archives-ouvertes.fr\/hal-03202360\/",">","`","_","S.","Khazem",",","S.","Chevallier",",","Q.","Barthelemy",",","K.","Haroun","and","C.","Nous",",","10th","International","IEEE\/EMBS","Conference","on","Neural","Engineering","(","NER",")",",","pp",".","523-526",".","IEEE",",","2021",".","Notes","--","--","-","..","versionadded",":",":","0.4"]
docstr: Return the mean accuracy on the given test data and labels.
  
  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
  -------
  score : float
      Mean accuracy of clf.predict(X) wrt. y_enc.
docstr_tok: ["Return","the","mean","accuracy","on","the","given","test","data","and","labels",".","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","--","--","--","-","score",":","float","Mean","accuracy","of","clf.predict","(","X",")","wrt",".","y_enc","."]
code: def score(self, X, y_enc, sample_weight=None):
      """Return the mean accuracy on the given test data and labels.
  
      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
      -------
      score : float
          Mean accuracy of clf.predict(X) wrt. y_enc.
      """
      _, y_true, _ = decode_domains(X, y_enc)
      y_pred = self.predict(X)
      return accuracy_score(y_true, y_pred)
  
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 3 for calling the MDWM obj's underlying member method code with example usage: obj.score(X, y_enc, sample_weight) and returns: accuracy_score