mne.decoding.
ReceptiveField
(tmin, tmax, sfreq, feature_names=None, estimator=None, fit_intercept=None, scoring='r2', patterns=False)[source]¶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).
Parameters: | tmin : float
tmax : float
sfreq : float
feature_names : array, shape (n_features,) | None
estimator : instance of sklearn estimator | float | None
fit_intercept : bool | None
scoring : [‘r2’, ‘corrcoef’]
patterns : bool
|
---|
See also
Notes
For a causal system, the encoding model will have significant non-zero values only at positive lags. In other words, lags point backward in time relative to the input, so positive lags correspond to previous input time samples, while negative lags correspond to future input time samples.
References
[R120124] | Theunissen, F. E. et al. Estimating spatio-temporal receptive fields of auditory and visual neurons from their responses to natural stimuli. Network 12, 289-316 (2001). |
[R121124] | Willmore, B. & Smyth, D. Methods for first-order kernel estimation: simple-cell receptive fields from responses to natural scenes. Network 14, 553-77 (2003). |
[R122124] | Crosse, M. J., Di Liberto, G. M., Bednar, A. & Lalor, E. C. (2016). The Multivariate Temporal Response Function (mTRF) Toolbox: A MATLAB Toolbox for Relating Neural Signals to Continuous Stimuli. Frontiers in Human Neuroscience 10, 604. doi:10.3389/fnhum.2016.00604 |
[R123124] | Holdgraf, C. R. et al. Rapid tuning shifts in human auditory cortex enhance speech intelligibility. Nature Communications, 7, 13654 (2016). doi:10.1038/ncomms13654 |
[R124124] | (1, 2) Haufe, S., Meinecke, F., Goergen, K., Daehne, S., Haynes, J.-D., Blankertz, B., & Biessmann, F. (2014). On the interpretation of weight vectors of linear models in multivariate neuroimaging. NeuroImage, 87, 96-110. doi:10.1016/j.neuroimage.2013.10.067 |
Attributes
``coef_`` | (array, shape ([n_outputs, ]n_features, n_delays)) The coefficients from the model fit, reshaped for easy visualization. During mne.decoding.ReceptiveField.fit() , if y has one dimension (time), the n_outputs dimension here is omitted. |
``patterns_`` | (array, shape ([n_outputs, ]n_features, n_delays)) If fit, the inverted coefficients from the model. |
``delays_``: array, shape (n_delays,), dtype int | The delays used to fit the model, in indices. To return the delays in seconds, use self.delays_ / self.sfreq |
``valid_samples_`` | (slice) The rows to keep during model fitting after removing rows with missing values due to time delaying. This can be used to get an output equivalent to using numpy.convolve() or numpy.correlate() with mode='valid' . |
Methods
__hash__ () <==> hash(x) |
|
fit (X, y) |
Fit a receptive field model. |
get_params ([deep]) |
Get parameters for this estimator. |
predict (X) |
Generate predictions with a receptive field. |
score (X, y) |
Score predictions generated with a receptive field. |
set_params (**params) |
Set the parameters of this estimator. |
__hash__
() <==> hash(x)¶fit
(X, y)[source]¶Fit a receptive field model.
Parameters: | X : array, shape (n_times[, n_epochs], n_features)
y : array, shape (n_times[, n_epochs][, n_outputs])
|
---|---|
Returns: | self : instance
|
get_params
(deep=True)[source]¶Get parameters for this estimator.
Parameters: | deep : boolean, optional
|
---|---|
Returns: | params : mapping of string to any
|
predict
(X)[source]¶Generate predictions with a receptive field.
Parameters: | X : array, shape (n_times[, n_epochs], n_channels)
|
---|---|
Returns: | y_pred : array, shape (n_times[, n_epochs][, n_outputs])
|
score
(X, y)[source]¶Score predictions generated with a receptive field.
This calls self.predict, then masks the output of this and y with self.mask_prediction_. Finally, it passes this to a sklearn scorer.
Parameters: | X : array, shape (n_times[, n_epochs], n_channels)
y : array, shape (n_times[, n_epochs][, n_outputs])
|
---|---|
Returns: | scores : list of float, shape (n_outputs,)
|
set_params
(**params)[source]¶Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each
component of a nested object.
Returns
——-
self