Skip to main content

PcaResult

Struct PcaResult 

Source
pub struct PcaResult {
    pub components: Vec<Vec<f64>>,
    pub explained_variance: Vec<f64>,
    pub explained_variance_ratio: Vec<f64>,
    pub mean: Vec<f64>,
    pub std_dev: Vec<f64>,
    pub n_samples: usize,
    pub n_features: usize,
    pub iterations_used: usize,
}
Expand description

PCA result containing components and explained variance

Fields§

§components: Vec<Vec<f64>>

Principal component vectors (n_components x n_features), row-major

§explained_variance: Vec<f64>

Variance explained by each component (eigenvalues)

§explained_variance_ratio: Vec<f64>

Proportion of total variance explained by each component

§mean: Vec<f64>

Feature means used for centering (needed to project new data)

§std_dev: Vec<f64>

Feature standard deviations (if scaling was used)

§n_samples: usize

Number of samples in the input data

§n_features: usize

Number of features in the input data

§iterations_used: usize

Number of iterations used (last component for PowerIteration, power iters for Randomized)

Implementations§

Source§

impl PcaResult

Source

pub fn transform(&self, data: &[Vec<f64>]) -> Vec<Vec<f64>>

Project multiple data points into the reduced PCA space.

Uses ndarray matrix multiplication for efficiency.

Source

pub fn transform_one(&self, point: &[f64]) -> Vec<f64>

Project a single data point into the reduced PCA space.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V