class_docstr: Artefact detection with the Riemannian Potato Field.
  
  The Riemannian Potato Field [1]_ is a clustering method used to detect
  artifact in EEG signals. The algorithm combines several potatoes of low
  dimension, each one being designed to capture specific artifact typically
  affecting specific subsets of channels and/or specific frequency bands.
  
  Parameters
  ----------
  n_potatoes : int, default=1
      Number of potatoes in the field.
  p_threshold : float, default=0.01
      Threshold on probability to being clean, in (0, 1), combining
      probabilities of potatoes using Fisher's method.
  z_threshold : float, default=3
      Threshold on z-score of distance to reject artifacts. It is the number
      of standard deviations from the mean of distances to the centroid.
  metric : string, default='riemann'
      The type of metric used for centroid and distance estimation.
  n_iter_max : int, default=10
      The maximum number of iteration to reach convergence.
  pos_label: int, default=1
      The positive label corresponding to clean data.
  neg_label: int, default=0
      The negative label corresponding to artifact data.
  
  Notes
  -----
  .. versionadded:: 0.3
  
  See Also
  --------
  Potato
  
  References
  ----------
  .. [1] `The Riemannian Potato Field: A Tool for Online Signal Quality Index
      of EEG
      <https://hal.archives-ouvertes.fr/hal-02015909>`_
      Q. Barthélemy, L. Mayaud, D. Ojeda, and M. Congedo. IEEE Transactions
      on Neural Systems and Rehabilitation Engineering, IEEE Institute of
      Electrical and Electronics Engineers, 2019, 27 (2), pp.244-255
docstr: Fit the potato field from covariance matrices.
  
  Fit the potato field from covariance matrices, with iterative
  outlier removal to obtain reliable potatoes.
  
  Parameters
  ----------
  X : list of n_potatoes ndarrays of shape (n_matrices, n_channels,                 n_channels) with same n_matrices but potentially different                 n_channels
      List of sets of SPD matrices, each corresponding to a different
      subset of EEG channels and/or filtering with a specific frequency
      band.
  y : None | ndarray, shape (n_matrices,), default=None
      Labels corresponding to each matrix: positive (resp. negative)
      label corresponds to a clean (resp. artifact) matrix.
      If None, all matrices are considered as clean.
  
  Returns
  -------
  self : PotatoField instance
      The PotatoField instance.
docstr_tok: ["Fit","the","potato","field","from","covariance","matrices",".","Fit","the","potato","field","from","covariance","matrices",",","with","iterative","outlier","removal","to","obtain","reliable","potatoes",".","Parameters","--","--","--","--","--","X",":","list","of","n_potatoes","ndarrays","of","shape","(","n_matrices",",","n_channels",",","n_channels",")","with","same","n_matrices","but","potentially","different","n_channels","List","of","sets","of","SPD","matrices",",","each","corresponding","to","a","different","subset","of","EEG","channels","and\/or","filtering","with","a","specific","frequency","band",".","y",":","None","|","ndarray",",","shape","(","n_matrices",",",")",",","default=None","Labels","corresponding","to","each","matrix",":","positive","(","resp",".","negative",")","label","corresponds","to","a","clean","(","resp",".","artifact",")","matrix",".","If","None",",","all","matrices","are","considered","as","clean",".","Returns","--","--","--","-","self",":","PotatoField","instance","The","PotatoField","instance","."]
code: def fit(self, X, y=None):
      """Fit the potato field from covariance matrices.
  
          Fit the potato field from covariance matrices, with iterative
          outlier removal to obtain reliable potatoes.
  
          Parameters
          ----------
          X : list of n_potatoes ndarrays of shape (n_matrices, n_channels, \
                  n_channels) with same n_matrices but potentially different \
                  n_channels
              List of sets of SPD matrices, each corresponding to a different
              subset of EEG channels and/or filtering with a specific frequency
              band.
          y : None | ndarray, shape (n_matrices,), default=None
              Labels corresponding to each matrix: positive (resp. negative)
              label corresponds to a clean (resp. artifact) matrix.
              If None, all matrices are considered as clean.
  
          Returns
          -------
          self : PotatoField instance
              The PotatoField instance.
          """
      if self.n_potatoes < 1:
          raise ValueError("Parameter n_potatoes must be at least 1")
      if not 0 < self.p_threshold < 1:
          raise ValueError("Parameter p_threshold must be in (0, 1)")
      self._check_length(X)
      n_matrices = X[0].shape[0]
  
      pt = Potato(
          metric=self.metric,
          threshold=self.z_threshold,
          n_iter_max=self.n_iter_max,
          pos_label=self.pos_label,
          neg_label=self.neg_label,
      )
      self._potatoes = []
      for i in range(self.n_potatoes):
          _check_n_matrices(X[i], n_matrices)
          self._potatoes.append(clone(pt))
          self._potatoes[i].fit(X[i], y)
  
      return self
  
imports: import numpy
  from joblib import Parallel, delayed
  from scipy.stats import norm, chi2
  import sklearn
  from sklearn.base import BaseEstimator, ClassifierMixin, TransformerMixin, ClusterMixin, clone
  from sklearn.cluster import KMeans
  from .classification import MDM, _check_metric
  from .utils.mean import mean_covariance
  from .utils.geodesic import geodesic
label_desc: Use image node_id 2 for calling the PotatoField obj's underlying member method code with example usage: obj.fit(X, y) and returns: self