pub struct Pca { /* private fields */ }Expand description
Principal Component Analysis. Reduces an n_samples × n_features
matrix to a lower-dimensional representation.
Implementations§
Source§impl Pca
impl Pca
Sourcepub fn new(n_components: usize) -> Result<Self>
pub fn new(n_components: usize) -> Result<Self>
Build a new PCA handle that retains n_components principal
directions, in f64 precision.
Sourcepub fn fit(
&mut self,
n_samples: usize,
n_features: usize,
data: &[f64],
) -> Result<()>
pub fn fit( &mut self, n_samples: usize, n_features: usize, data: &[f64], ) -> Result<()>
Fit on column-major n_samples × n_features data.
Sourcepub fn transform(
&mut self,
m_samples: usize,
m_features: usize,
x: &[f64],
n_components: usize,
out: &mut [f64],
) -> Result<()>
pub fn transform( &mut self, m_samples: usize, m_features: usize, x: &[f64], n_components: usize, out: &mut [f64], ) -> Result<()>
Project m_samples × m_features new data into the fitted
principal-component space. out receives the transformed
m_samples × n_components matrix in column-major layout
(ldx_transform = m_samples).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Pca
impl !RefUnwindSafe for Pca
impl !Sync for Pca
impl Forget for Pca
impl Move for Pca
impl Send for Pca
impl Unpin for Pca
impl UnsafeUnpin for Pca
impl UnwindSafe for Pca
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