Expand description

Principal Component Analysis Module

Contains implementation of PCA.

Examples

use rusty_machine::learning::pca::PCA;
use rusty_machine::learning::UnSupModel;

use rusty_machine::linalg::Matrix;
let mut pca = PCA::default();

let inputs = Matrix::new(3, 2, vec![1., 0.1,
                                    3., 0.2,
                                    4., 0.2]);
// Train the model
pca.train(&inputs).unwrap();

// Mapping a new point to principal component space
let new_data = Matrix::new(1, 2, vec![2., 0.1]);
let output = pca.predict(&new_data).unwrap();

assert_eq!(output, Matrix::new(1, 2, vec![-0.6686215718235227, 0.042826190364433595]));

Structs

Principal Component Analysis