code: def test_rank_deficiency():
      """Test signals that are rank deficient."""
      # See GH#4253
      pytest.importorskip("sklearn")
      from sklearn.linear_model import Ridge
  
      N = 256
      fs = 1.0
      tmin, tmax = -50, 100
      reg = 0.1
      rng = np.random.RandomState(0)
      eeg = rng.randn(N, 1)
      eeg *= 100
      eeg = rfft(eeg, axis=0)
      eeg[N // 4 :] = 0  # rank-deficient lowpass
      eeg = irfft(eeg, axis=0)
      win = np.hanning(N // 8)
      win /= win.mean()
      y = np.apply_along_axis(np.convolve, 0, eeg, win, mode="same")
      y += rng.randn(*y.shape) * 100
  
      for est in (Ridge(reg), reg):
          rf = ReceptiveField(
              tmin, tmax, fs, estimator=est, patterns=True
          )
          rf.fit(eeg, y)
          pred = rf.predict(eeg)
          assert_equal(y.shape, pred.shape)
          corr = np.corrcoef(y.ravel(), pred.ravel())[0, 1]
          assert corr > 0.995
  
imports: from pathlib import Path
  import numpy
  import pytest
  from numpy import einsum
  from numpy.fft import irfft, rfft
  from numpy.testing import assert_allclose, assert_array_equal, assert_equal
  from mne.decoding import ReceptiveField, TimeDelayingRidge
  from mne.decoding.receptive_field import _SCORERS, _delay_time_series, _delays_to_slice, _times_to_delays
  from mne.decoding.time_delaying_ridge import _compute_corrs, _compute_reg_neighbors
label_desc: Use image node_id 2 for calling a global function with example usage: test_rank_deficiency() without return types