code: def clf_fit_independence(spfilt, X, labels, n_channels):
      if spfilt is BilinearFilter:
          sf = spfilt(np.eye(n_channels))
      elif spfilt is AJDC:
          sf = spfilt(dim_red={"max_cond": 10})
      else:
          sf = spfilt()
      sf.fit(X, labels)
      if spfilt is Xdawn:
          X_new = X[:, :-1, :]
      elif spfilt in (CSP, SPoC, BilinearFilter):
          X_new = X[:, :-1, :-1]
      elif spfilt is AJDC:
          X_new = X[:, :, :-1, :]
      # retraining with different size should erase previous fit
      sf.fit(X_new, labels)
  
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 6 for calling a global function with example usage: clf_fit_independence(spfilt, X, labels, n_channels) without return types