pub struct CSP { /* private fields */ }Expand description
Common Spatial Patterns filter.
Implementations§
Source§impl CSP
impl CSP
Sourcepub fn new(n_components: usize) -> Self
pub fn new(n_components: usize) -> Self
Create a new CSP with n_components pairs of spatial filters.
The total number of output features will be 2 * n_components.
Sourcepub fn fit(&mut self, class1: &[Vec<Vec<f64>>], class2: &[Vec<Vec<f64>>])
pub fn fit(&mut self, class1: &[Vec<Vec<f64>>], class2: &[Vec<Vec<f64>>])
Fit CSP filters from two classes of epoch data.
Each epoch is [n_channels][n_samples]. All epochs must have the
same number of channels.
Sourcepub fn transform(&self, epoch: &[Vec<f64>]) -> Vec<f64>
pub fn transform(&self, epoch: &[Vec<f64>]) -> Vec<f64>
Transform a single epoch into CSP features.
Returns log(var(W^T X)) for each spatial filter — one value per component.
The epoch shape is [n_channels][n_samples].
Sourcepub fn transform_all(&self, epochs: &[Vec<Vec<f64>>]) -> Vec<Vec<f64>>
pub fn transform_all(&self, epochs: &[Vec<Vec<f64>>]) -> Vec<Vec<f64>>
Transform multiple epochs into a feature matrix.
Returns [n_epochs][2*n_components].
Sourcepub fn n_features(&self) -> usize
pub fn n_features(&self) -> usize
Number of output features (2 × n_components).
Sourcepub fn eigenvalues(&self) -> &[f64]
pub fn eigenvalues(&self) -> &[f64]
Get the eigenvalues.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CSP
impl RefUnwindSafe for CSP
impl Send for CSP
impl Sync for CSP
impl Unpin for CSP
impl UnsafeUnpin for CSP
impl UnwindSafe for CSP
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more