code: def test_xdawn_decoding_performance():
      """Test decoding performance and extracted pattern on synthetic data."""
      pytest.importorskip("sklearn")
      from sklearn.linear_model import LogisticRegression
      from sklearn.metrics import accuracy_score
      from sklearn.model_selection import KFold
      from sklearn.pipeline import make_pipeline
      from sklearn.preprocessing import MinMaxScaler
  
      n_xdawn_comps = 3
      expected_accuracy = 0.98
  
      epochs, mixing_mat = _simulate_erplike_mixed_data(n_epochs=100)
      y = epochs.events[:, 2]
  
      # results of Xdawn and _XdawnTransformer should match
      xdawn_pipe = make_pipeline(
          Xdawn(n_components=n_xdawn_comps),
          Vectorizer(),
          MinMaxScaler(),
          LogisticRegression(solver="liblinear"),
      )
      xdawn_trans_pipe = make_pipeline(
          _XdawnTransformer(n_components=n_xdawn_comps),
          Vectorizer(),
          MinMaxScaler(),
          LogisticRegression(solver="liblinear"),
      )
  
      cv = KFold(n_splits=3, shuffle=False)
      for pipe, X in (
          (xdawn_pipe, epochs),
          (xdawn_trans_pipe, epochs.get_data(copy=False)),
      ):
          predictions = np.empty_like(y, dtype=float)
          for train, test in cv.split(X, y):
              pipe.fit(X[train], y[train])
              predictions[test] = pipe.predict(X[test])
  
          cv_accuracy_xdawn = accuracy_score(y, predictions)
          assert_allclose(
              cv_accuracy_xdawn, expected_accuracy, atol=0.01
          )
  
          # for both event types, the first component should "match" the mixing
          fitted_xdawn = pipe.steps[0][1]
          if isinstance(fitted_xdawn, Xdawn):
              relev_patterns = np.concatenate(
                  [
                      comps[[0]]
                      for comps in fitted_xdawn.patterns_.values()
                  ]
              )
          else:
              relev_patterns = fitted_xdawn.patterns_[::n_xdawn_comps]
  
          for i in range(len(relev_patterns)):
              r, _ = stats.pearsonr(
                  relev_patterns[i, :], mixing_mat[0, :]
              )
              assert np.abs(r) > 0.99
  
file_path: mne-python/mne/preprocessing/tests/test_xdawn.py
imports: from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal
  from scipy import stats
  from mne import Epochs, EpochsArray, compute_raw_covariance, create_info, pick_types, read_events
  from mne.decoding import Vectorizer
  from mne.fixes import _safe_svd
  from mne.io import read_raw_fif
  from mne.preprocessing.xdawn import Xdawn, _XdawnTransformer
label_desc: Use image node_id 9 for calling a global function with example usage: test_xdawn_decoding_performance() without return types