pub struct PCA { /* private fields */ }
Expand description
Principal Component Analysis
- PCA uses rulinalg SVD which is experimental (not yet work for large data)
Implementations
sourceimpl PCA
impl PCA
sourcepub fn new(n: usize, center: bool) -> PCA
pub fn new(n: usize, center: bool) -> PCA
Constructs untrained PCA model.
Parameters
n
: number of principal componentscenter
: flag whether centering inputs to be specified.
Examples
use rusty_machine::learning::pca::PCA;
let model = PCA::new(3, true);
sourcepub fn components(&self) -> LearningResult<&Matrix<f64>>
pub fn components(&self) -> LearningResult<&Matrix<f64>>
Returns principal components (matrix which contains eigenvectors as columns)
Trait Implementations
sourceimpl Default for PCA
impl Default for PCA
The default PCA.
Parameters:
n
=None
(keep all components)center
=true
Examples
use rusty_machine::learning::pca::PCA;
let model = PCA::default();
sourceimpl UnSupModel<Matrix<f64>, Matrix<f64>> for PCA
impl UnSupModel<Matrix<f64>, Matrix<f64>> for PCA
Train the model and predict the model output from new data.
sourcefn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Matrix<f64>>
fn predict(&self, inputs: &Matrix<f64>) -> LearningResult<Matrix<f64>>
Predict output from inputs.
sourcefn train(&mut self, inputs: &Matrix<f64>) -> LearningResult<()>
fn train(&mut self, inputs: &Matrix<f64>) -> LearningResult<()>
Train the model using inputs.
Auto Trait Implementations
impl RefUnwindSafe for PCA
impl Send for PCA
impl Sync for PCA
impl Unpin for PCA
impl UnwindSafe for PCA
Blanket Implementations
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more