pub struct PCA<T: Number + RealNumber, X: Array2<T> + SVDDecomposable<T> + EVDDecomposable<T>> { /* private fields */ }
Expand description

Principal components analysis algorithm

Implementations§

source§

impl<T: Number + RealNumber, X: Array2<T> + SVDDecomposable<T> + EVDDecomposable<T>> PCA<T, X>

source

pub fn fit(data: &X, parameters: PCAParameters) -> Result<PCA<T, X>, Failed>

Fits PCA to your data.

  • data - NxM matrix with N observations and M features in each observation.
  • n_components - number of components to keep.
  • parameters - other parameters, use Default::default() to set parameters to default values.
source

pub fn transform(&self, x: &X) -> Result<X, Failed>

Run dimensionality reduction for x

  • x - KxM data where K is number of observations and M is number of features.
source

pub fn components(&self) -> &X

Get a projection matrix

Trait Implementations§

source§

impl<T: Debug + Number + RealNumber, X: Debug + Array2<T> + SVDDecomposable<T> + EVDDecomposable<T>> Debug for PCA<T, X>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Number + RealNumber, X: Array2<T> + SVDDecomposable<T> + EVDDecomposable<T>> PartialEq<PCA<T, X>> for PCA<T, X>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Number + RealNumber, X: Array2<T> + SVDDecomposable<T> + EVDDecomposable<T>> Transformer<X> for PCA<T, X>

source§

fn transform(&self, x: &X) -> Result<X, Failed>

Transform data by modifying or filtering it Read more
source§

impl<T: Number + RealNumber, X: Array2<T> + SVDDecomposable<T> + EVDDecomposable<T>> UnsupervisedEstimator<X, PCAParameters> for PCA<T, X>

source§

fn fit(x: &X, parameters: PCAParameters) -> Result<Self, Failed>

Fit a model to a training dataset, estimate model’s parameters. Read more

Auto Trait Implementations§

§

impl<T, X> RefUnwindSafe for PCA<T, X>where T: RefUnwindSafe, X: RefUnwindSafe,

§

impl<T, X> Send for PCA<T, X>where T: Send, X: Send,

§

impl<T, X> Sync for PCA<T, X>where T: Sync, X: Sync,

§

impl<T, X> Unpin for PCA<T, X>where T: Unpin, X: Unpin,

§

impl<T, X> UnwindSafe for PCA<T, X>where T: UnwindSafe, X: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.