class_docstr: Minimum Distance to Mean (MDM) classifier on manifolds.
  
  Classification by nearest centroid. For each of the given classes, a
  centroid is estimated according to the chosen metric. Then, for each new
  point, the class is affected according to the nearest centroid [BBCJ2012]_.
  
  Parameters
  ----------
  space : Manifold
      Equipped manifold.
  
  Attributes
  ----------
  classes_ : array-like, shape=[n_classes,]
      If fit, labels of training set.
  mean_estimates_ : array-like, shape=[n_classes, *space.shape]
      If fit, centroids computed on training set.
  
  Notes
  -----
  * Required metric methods: `squared_dist`, `closest_neighbot_index`.
  
  References
  ----------
  .. [BBCJ2012] A. Barachant, S. Bonnet, M. Congedo and C. Jutten, Multiclass
      Brain-Computer Interface Classification by Riemannian Geometry. IEEE
      Trans. Biomed. Eng., vol. 59, pp. 920-928, 2012.
class_docstr_tok: ["Minimum","Distance","to","Mean","(","MDM",")","classifier","on","manifolds",".","Classification","by","nearest","centroid",".","For","each","of","the","given","classes",",","a","centroid","is","estimated","according","to","the","chosen","metric",".","Then",",","for","each","new","point",",","the","class","is","affected","according","to","the","nearest","centroid","[","BBCJ2012","]","_.","Parameters","--","--","--","--","--","space",":","Manifold","Equipped","manifold",".","Attributes","--","--","--","--","--","classes_",":","array-like",",","shape=","[","n_classes",",","]","If","fit",",","labels","of","training","set",".","mean_estimates_",":","array-like",",","shape=","[","n_classes",",","*","space.shape","]","If","fit",",","centroids","computed","on","training","set",".","Notes","--","--","-","*","Required","metric","methods",":","`","squared_dist","`",",","`","closest_neighbot_index","`",".","References","--","--","--","--","--","..","[","BBCJ2012","]","A.","Barachant",",","S.","Bonnet",",","M.","Congedo","and","C.","Jutten",",","Multiclass","Brain-Computer","Interface","Classification","by","Riemannian","Geometry",".","IEEE","Trans",".","Biomed",".","Eng.",",","vol",".","59",",","pp",".","920-928",",","2012","."]
docstr: Compute Frechet mean of each class.
  
  Parameters
  ----------
  X : array-like, shape=[n_samples, *space.shape]
      Training input samples.
  y : array-like, shape=[n_samples,]
      Training labels.
  weights : array-like, shape=[n_samples,]
      Weights associated to the samples.
      Optional, default: None, in which case it is equally weighted.
  
  Returns
  -------
  self : object
      Returns self.
docstr_tok: ["Compute","Frechet","mean","of","each","class",".","Parameters","--","--","--","--","--","X",":","array-like",",","shape=","[","n_samples",",","*","space.shape","]","Training","input","samples",".","y",":","array-like",",","shape=","[","n_samples",",","]","Training","labels",".","weights",":","array-like",",","shape=","[","n_samples",",","]","Weights","associated","to","the","samples",".","Optional",",","default",":","None",",","in","which","case","it","is","equally","weighted",".","Returns","--","--","--","-","self",":","object","Returns","self","."]
code: def fit(self, X, y, weights=None):
      """Compute Frechet mean of each class.
  
      Parameters
      ----------
      X : array-like, shape=[n_samples, *space.shape]
          Training input samples.
      y : array-like, shape=[n_samples,]
          Training labels.
      weights : array-like, shape=[n_samples,]
          Weights associated to the samples.
          Optional, default: None, in which case it is equally weighted.
  
      Returns
      -------
      self : object
          Returns self.
      """
      self.classes_ = gs.unique(y)
      if weights is None:
          weights = gs.ones(X.shape[0])
      weights /= gs.sum(weights)
  
      frechet_means = []
      for c in self.classes_:
          X_c = X[gs.where(y == c, True, False)]
          weights_c = weights[gs.where(y == c, True, False)]
          mean_c = self.mean_estimator.fit(
              X_c, weights=weights_c
          ).estimate_
          frechet_means.append(mean_c)
  
      self.mean_estimates_ = gs.array(frechet_means)
  
      return self
  
file_path: geomstats/geomstats/learning/mdm.py
imports: from scipy.special import softmax
  from sklearn.base import BaseEstimator, ClassifierMixin
  import geomstats.backend
  from geomstats.learning._template import TransformerMixin
  from geomstats.learning.frechet_mean import FrechetMean
label_desc: Use image node_id 3 for calling the RiemannianMinimumDistanceToMean obj's underlying member method code with example usage: obj.fit(X, y, weights) and returns: self