class_docstr: Transformer to compute event-matched spatial filters.
  
  This version of EMS :footcite:`SchurgerEtAl2013` operates on the entire
  time course. No time
  window needs to be specified. The result is a spatial filter at each
  time point and a corresponding time course. Intuitively, the result
  gives the similarity between the filter at each time point and the
  data vector (sensors) at that time point.
  
  .. note:: EMS only works for binary classification.
  
  Attributes
  ----------
  filters_ : ndarray, shape (n_channels, n_times)
      The set of spatial filters.
  classes_ : ndarray, shape (n_classes,)
      The target classes.
  
  References
  ----------
  .. footbibliography::
docstr: Fit the spatial filters.
  
  .. note : EMS is fitted on data normalized by channel type before the
            fitting of the spatial filters.
  
  Parameters
  ----------
  X : array, shape (n_epochs, n_channels, n_times)
      The training data.
  y : array of int, shape (n_epochs)
      The target classes.
  
  Returns
  -------
  self : instance of EMS
      Returns self.
docstr_tok: ["Fit","the","spatial","filters",".","..","note",":","EMS","is","fitted","on","data","normalized","by","channel","type","before","the","fitting","of","the","spatial","filters",".","Parameters","--","--","--","--","--","X",":","array",",","shape","(","n_epochs",",","n_channels",",","n_times",")","The","training","data",".","y",":","array","of","int",",","shape","(","n_epochs",")","The","target","classes",".","Returns","--","--","--","-","self",":","instance","of","EMS","Returns","self","."]
code: def fit(self, X, y):
      """Fit the spatial filters.
  
      .. note : EMS is fitted on data normalized by channel type before the
                fitting of the spatial filters.
  
      Parameters
      ----------
      X : array, shape (n_epochs, n_channels, n_times)
          The training data.
      y : array of int, shape (n_epochs)
          The target classes.
  
      Returns
      -------
      self : instance of EMS
          Returns self.
      """
      classes = np.unique(y)
      if len(classes) != 2:
          raise ValueError("EMS only works for binary classification.")
      self.classes_ = classes
      filters = X[y == classes[0]].mean(0) - X[y == classes[1]].mean(0)
      filters /= np.linalg.norm(filters, axis=0)[None, :]
      self.filters_ = filters
      return self
  
file_path: mne-python/mne/decoding/ems.py
imports: from collections import Counter
  import numpy
  from .._fiff.pick import _picks_to_idx, pick_info, pick_types
  from ..parallel import parallel_func
  from ..utils import logger, verbose
  from .base import _set_cv
  from .mixin import EstimatorMixin, TransformerMixin
label_desc: Use image node_id 2 for calling the EMS obj's underlying member method code with example usage: obj.fit(X, y) and returns: self