TimeDelayingRidge
and Ridge
and I think this is a cause
TimeDelayingRidge
behave like Ridge
, or vice-versa
Ridge
way is better with an example that makes the problem bad:import numpy as np
import mne
from sklearn.linear_model import Ridge
X = np.random.RandomState(0).randn(10)
X[0] = 10000
X[-1] = -10000
sfreq = 1.
tmin, tmax = -1, 2
kernel = [2, 1]
y = np.convolve(X, kernel, mode='same')
for est in (Ridge(alpha=0., fit_intercept=True),
mne.decoding.TimeDelayingRidge(tmin, tmax, sfreq,
fit_intercept=True)):
rf = mne.decoding.ReceptiveField(tmin, tmax, sfreq,
estimator=est, )
rf.fit(X[:, np.newaxis], y)
print(rf.coef_.round(3))
[[-0.01 1.944 1.008 0.01 ]]
[[ 0.1 2. 0.9 -0.1]]
Ridge
does better