class_docstr: Implementation of the Xdawn Algorithm compatible with scikit-learn.
  
  Xdawn is a spatial filtering method designed to improve the signal
  to signal + noise ratio (SSNR) of the event related responses. Xdawn was
  originally designed for P300 evoked potential by enhancing the target
  response with respect to the non-target response. This implementation is a
  generalization to any type of event related response.
  
  .. note:: _XdawnTransformer does not correct for epochs overlap. To correct
            overlaps see ``Xdawn``.
  
  Parameters
  ----------
  n_components : int (default 2)
      The number of components to decompose the signals.
  reg : float | str | None (default None)
      If not None (same as ``'empirical'``, default), allow
      regularization for covariance estimation.
      If float, shrinkage is used (0 <= shrinkage <= 1).
      For str options, ``reg`` will be passed to ``method`` to
      :func:`mne.compute_covariance`.
  signal_cov : None | Covariance | array, shape (n_channels, n_channels)
      The signal covariance used for whitening of the data.
      if None, the covariance is estimated from the epochs signal.
  method_params : dict | None
      Parameters to pass to :func:`mne.compute_covariance`.
  
      .. versionadded:: 0.16
  
  Attributes
  ----------
  classes_ : array, shape (n_classes)
      The event indices of the classes.
  filters_ : array, shape (n_channels, n_channels)
      The Xdawn components used to decompose the data for each event type.
  patterns_ : array, shape (n_channels, n_channels)
      The Xdawn patterns used to restore the signals for each event type.
docstr: Fit Xdawn spatial filters.
  
  Parameters
  ----------
  X : array, shape (n_epochs, n_channels, n_samples)
      The target data.
  y : array, shape (n_epochs,) | None
      The target labels. If None, Xdawn fit on the average evoked.
  
  Returns
  -------
  self : Xdawn instance
      The Xdawn instance.
docstr_tok: ["Fit","Xdawn","spatial","filters",".","Parameters","--","--","--","--","--","X",":","array",",","shape","(","n_epochs",",","n_channels",",","n_samples",")","The","target","data",".","y",":","array",",","shape","(","n_epochs",",",")","|","None","The","target","labels",".","If","None",",","Xdawn","fit","on","the","average","evoked",".","Returns","--","--","--","-","self",":","Xdawn","instance","The","Xdawn","instance","."]
code: def fit(self, X, y=None):
      """Fit Xdawn spatial filters.
  
      Parameters
      ----------
      X : array, shape (n_epochs, n_channels, n_samples)
          The target data.
      y : array, shape (n_epochs,) | None
          The target labels. If None, Xdawn fit on the average evoked.
  
      Returns
      -------
      self : Xdawn instance
          The Xdawn instance.
      """
      X, y = self._check_Xy(X, y)
  
      # Main function
      self.classes_ = np.unique(y)
      self.filters_, self.patterns_, _ = _fit_xdawn(
          X,
          y,
          n_components=self.n_components,
          reg=self.reg,
          signal_cov=self.signal_cov,
          method_params=self.method_params,
      )
      return self
  
imports: import numpy
  from scipy import linalg
  from .._fiff.pick import _pick_data_channels, pick_info
  from ..cov import Covariance, _regularized_covariance
  from ..decoding import BaseEstimator, TransformerMixin
  from ..epochs import BaseEpochs
  from ..evoked import Evoked, EvokedArray
  from ..io import BaseRaw
  from ..utils import _check_option, logger
label_desc: Use image node_id 2 for calling the _XdawnTransformer obj's underlying member method code with example usage: obj.fit(X, y) and returns: self