code: def clf_fit(spfilt, X, labels, n_channels, n_times):
      n_classes = len(np.unique(labels))
      if spfilt is BilinearFilter:
          n_filters = 4
          sf = spfilt(filters=np.eye(n_filters, n_channels))
      elif spfilt is AJDC:
          sf = spfilt(dim_red={"n_components": n_channels - 1})
      else:
          sf = spfilt()
  
      sf.fit(X, labels)
  
      if spfilt is AJDC:
          assert sf.forward_filters_.shape == (
              sf.n_sources_,
              n_channels,
          )
      elif spfilt is BilinearFilter:
          assert sf.filters_.shape == (n_filters, n_channels)
      elif spfilt is Xdawn:
          n_components = min(n_channels, sf.nfilter)
          assert len(sf.classes_) == n_classes
          assert sf.filters_.shape == (
              n_classes * n_components,
              n_channels,
          )
          assert sf.patterns_.shape == (
              n_classes * n_components,
              n_channels,
          )
          assert sf.evokeds_.shape == (
              n_classes * n_components,
              n_times,
          )
      elif spfilt in [CSP, SPoC]:
          n_components = min(n_channels, sf.nfilter)
          assert sf.filters_.shape == (n_components, n_channels)
          assert sf.patterns_.shape == (n_components, n_channels)
  
imports: from conftest import get_metrics
  import pytest
  import numpy
  from numpy.testing import assert_array_equal
  from pyriemann.spatialfilters import Xdawn, CSP, SPoC, BilinearFilter, AJDC
label_desc: Use image node_id 2 for calling a global function with example usage: clf_fit(spfilt, X, labels, n_channels, n_times) without return types