code: def test_inverse_coef():
      """Test inverse coefficients computation."""
      pytest.importorskip("sklearn")
      from sklearn.linear_model import Ridge
  
      tmin, tmax = 0.0, 10.0
      n_feats, n_targets, n_samples = 3, 2, 1000
      n_delays = int((tmax - tmin) + 1)
  
      # Check coefficient dims, for all estimator types
      X, y = _make_data(n_feats, n_targets, n_samples, tmin, tmax)
      tdr = TimeDelayingRidge(tmin, tmax, 1.0, 0.1, "laplacian")
      for estimator in (0.0, 0.01, Ridge(alpha=0.0), tdr):
          rf = ReceptiveField(
              tmin, tmax, 1.0, estimator=estimator, patterns=True
          )
          rf.fit(X, y)
          inv_rf = ReceptiveField(
              tmin, tmax, 1.0, estimator=estimator, patterns=True
          )
          inv_rf.fit(y, X)
  
          assert_array_equal(
              rf.coef_.shape,
              rf.patterns_.shape,
              (n_targets, n_feats, n_delays),
          )
          assert_array_equal(
              inv_rf.coef_.shape,
              inv_rf.patterns_.shape,
              (n_feats, n_targets, n_delays),
          )
  
          # we should have np.dot(patterns.T,coef) ~ np.eye(n)
          c0 = rf.coef_.reshape(n_targets, n_feats * n_delays)
          c1 = rf.patterns_.reshape(n_targets, n_feats * n_delays)
          assert_allclose(
              np.dot(c0, c1.T), np.eye(c0.shape[0]), atol=0.2
          )
  
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 9 for calling a global function with example usage: test_inverse_coef() without return types