Fit a receptive field model. This allows you to fit an encoding model (stimulus to brain) or a decoding model (brain to stimulus) using time-lagged input features (for example, a spectro- or spatio-temporal receptive field, or STRF) :footcite:`TheunissenEtAl2001,WillmoreSmyth2003,Cr
| 24 | |
| 25 | @fill_doc |
| 26 | class ReceptiveField(MetaEstimatorMixin, BaseEstimator): |
| 27 | """Fit a receptive field model. |
| 28 | |
| 29 | This allows you to fit an encoding model (stimulus to brain) or a decoding |
| 30 | model (brain to stimulus) using time-lagged input features (for example, a |
| 31 | spectro- or spatio-temporal receptive field, or STRF) |
| 32 | :footcite:`TheunissenEtAl2001,WillmoreSmyth2003,CrosseEtAl2016,HoldgrafEtAl2016`. |
| 33 | |
| 34 | Parameters |
| 35 | ---------- |
| 36 | tmin : float |
| 37 | The starting lag, in seconds (or samples if ``sfreq`` == 1). |
| 38 | tmax : float |
| 39 | The ending lag, in seconds (or samples if ``sfreq`` == 1). |
| 40 | Must be >= tmin. |
| 41 | sfreq : float |
| 42 | The sampling frequency used to convert times into samples. |
| 43 | feature_names : array, shape (n_features,) | None |
| 44 | Names for input features to the model. If None, feature names will |
| 45 | be auto-generated from the shape of input data after running `fit`. |
| 46 | estimator : instance of sklearn.base.BaseEstimator | float | None |
| 47 | The model used in fitting inputs and outputs. This can be any |
| 48 | scikit-learn-style model that contains a fit and predict method. If a |
| 49 | float is passed, it will be interpreted as the ``alpha`` parameter |
| 50 | to be passed to a Ridge regression model. If `None`, then a Ridge |
| 51 | regression model with an alpha of 0 will be used. |
| 52 | fit_intercept : bool | None |
| 53 | If True (default), the sample mean is removed before fitting. |
| 54 | If ``estimator`` is a :class:`sklearn.base.BaseEstimator`, |
| 55 | this must be None or match ``estimator.fit_intercept``. |
| 56 | scoring : ['r2', 'corrcoef'] |
| 57 | Defines how predictions will be scored. Currently must be one of |
| 58 | 'r2' (coefficient of determination) or 'corrcoef' (the correlation |
| 59 | coefficient). |
| 60 | patterns : bool |
| 61 | If True, inverse coefficients will be computed upon fitting using the |
| 62 | covariance matrix of the inputs, and the cross-covariance of the |
| 63 | inputs/outputs, according to :footcite:`HaufeEtAl2014`. Defaults to |
| 64 | False. |
| 65 | n_jobs : int | str |
| 66 | Number of jobs to run in parallel. Can be 'cuda' if CuPy |
| 67 | is installed properly and ``estimator is None``. |
| 68 | |
| 69 | .. versionadded:: 0.18 |
| 70 | edge_correction : bool |
| 71 | If True (default), correct the autocorrelation coefficients for |
| 72 | non-zero delays for the fact that fewer samples are available. |
| 73 | Disabling this speeds up performance at the cost of accuracy |
| 74 | depending on the relationship between epoch length and model |
| 75 | duration. Only used if ``estimator`` is float or None. |
| 76 | |
| 77 | .. versionadded:: 0.18 |
| 78 | |
| 79 | Attributes |
| 80 | ---------- |
| 81 | coef_ : array, shape ([n_outputs, ]n_features, n_delays) |
| 82 | The coefficients from the model fit, reshaped for easy visualization. |
| 83 | During :meth:`mne.decoding.ReceptiveField.fit`, if ``y`` has one |
no outgoing calls