pyriemann.geometry.covariance.covariance_scm¶
- pyriemann.geometry.covariance.covariance_scm(X, *, assume_centered=False, weights=None)[source]¶
Sample covariance estimator.
Sample covariance estimator, re-implementing
empirical_covarianceof scikit-learn [1], but supporting:real and complex-valued data,
broadcasting,
weights for time samples.
\[\mathbf{C}_\text{scm} = \mathbf{X} \text{diag}(w) \mathbf{X}^H\]with \(w\) being the weights which sum to 1.
- Parameters:
- Xndarray, shape (…, n_channels, n_times)
Multi-channel time-series, real or complex-valued.
- assume_centeredbool, default=False
If True, data will not be centered before computation. Useful when working with data whose mean is almost, but not exactly zero. If False, data will be centered before computation.
- weightsNone | ndarray, shape (n_times,), default=None
Weights for each time sample. If None, it uses equal weights.
Added in version 0.11.
- Returns:
- covndarray, shape (…, n_channels, n_channels)
Sample covariance matrix.
Notes
Added in version 0.6.
Changed in version 0.11: Add weights.
Changed in version 0.12: Add support for NumPy and PyTorch.
References