'Fit a receptive field model.
Parameters
X : array, shape (n_times[, n_epochs], n_features)
The input features for the model.
y : array, shape (n_times[, n_epochs][, n_outputs])
The output features for the model.
Returns
self : instance
The instance so you can chain operations.'

def fit(self, X, y):

    if (self.scoring not in _SCORERS.keys()):
        raise ValueError(('scoring    must    be    one    of    %s,    got%s    ' % (sorted(_SCORERS.keys()), self.scoring)))
    from sklearn.base import is_regressor, clone
    (X, y, _, self._y_dim) = self._check_dimensions(X, y)
    self.delays_ = _times_to_delays(self.tmin, self.tmax, self.sfreq)
    self.valid_samples_ = _delays_to_slice(self.delays_)
    if isinstance(self.estimator, numbers.Real):
        if (self.fit_intercept is None):
            self.fit_intercept = True
        estimator = TimeDelayingRidge(self.tmin, self.tmax, self.sfreq, alpha=self.estimator, fit_intercept=self.fit_intercept)
    elif is_regressor(self.estimator):
        estimator = clone(self.estimator)
        if ((self.fit_intercept is not None) and (estimator.fit_intercept != self.fit_intercept)):
            raise ValueError(('Estimator    fit_intercept    (%s)    !=    initialization    fit_intercept    (%s),    initialize    ReceptiveField    with    the    same    fit_intercept    value    or    use    fit_intercept=None' % (estimator.fit_intercept, self.fit_itercept)))
        self.fit_intercept = estimator.fit_intercept
    else:
        raise ValueError(('`estimator`    must    be    a    float    or    an    instance    of    `BaseEstimator`,    got    type    %s.' % type(self.estimator)))
    self.estimator_ = estimator
    del estimator
    _check_estimator(self.estimator_)
    (n_times, n_epochs, n_feats) = X.shape
    if (self.feature_names is None):
        self.feature_names = [('feature_%s' % ii) for ii in range(n_feats)]
    if (len(self.feature_names) != n_feats):
        raise ValueError(('n_features    in    X    does    not    match    feature    names    (%s    !=    %s)' % (n_feats, len(self.feature_names))))
    if isinstance(self.estimator, TimeDelayingRidge):
        X = _pad_time_series(X, n_delays=len(self.delays_), fill_mean=self.fit_intercept)
        y = _pad_time_series(y, n_delays=len(self.delays_), fill_mean=self.fit_intercept)
    (X, y) = self._delay_and_reshape(X, y)
    self.estimator_.fit(X, y)
    del X, y
    coef = get_coef(self.estimator_, 'coef_')
    shape = [n_feats, len(self.delays_)]
    shape = (([(-1)] if (self._y_dim > 1) else []) + shape)
    self.coef_ = coef.reshape(shape)
    return self
