pub struct TypeSafePCA<State: DecompositionState, const RANK: usize> {
pub n_components: usize,
pub center: bool,
pub scale: bool,
/* private fields */
}Expand description
Type-safe PCA with compile-time rank checking
Fields§
§n_components: usizeNumber of components (must match RANK)
center: boolWhether to center the data
scale: boolWhether to scale the data
Implementations§
Source§impl<const RANK: usize> TypeSafePCA<Untrained, RANK>
impl<const RANK: usize> TypeSafePCA<Untrained, RANK>
Source§impl<const RANK: usize> TypeSafePCA<Fitted, RANK>
impl<const RANK: usize> TypeSafePCA<Fitted, RANK>
Sourcepub fn transform(&self, data: &Array2<Float>) -> Result<Array2<Float>>
pub fn transform(&self, data: &Array2<Float>) -> Result<Array2<Float>>
Transform data using the fitted components
Sourcepub fn components(&self) -> &Array2<Float>
pub fn components(&self) -> &Array2<Float>
Get the fitted components (guaranteed to be RANK columns)
Sourcepub fn explained_variance(&self) -> &Array1<Float>
pub fn explained_variance(&self) -> &Array1<Float>
Get explained variance (guaranteed to be RANK elements)
Sourcepub fn explained_variance_ratio(&self) -> Array1<Float>
pub fn explained_variance_ratio(&self) -> Array1<Float>
Get explained variance ratios
Sourcepub fn fit_transform(
untrained: TypeSafePCA<Untrained, RANK>,
data: &Array2<Float>,
) -> Result<(TypeSafePCA<Fitted, RANK>, Array2<Float>)>
pub fn fit_transform( untrained: TypeSafePCA<Untrained, RANK>, data: &Array2<Float>, ) -> Result<(TypeSafePCA<Fitted, RANK>, Array2<Float>)>
Fit and transform in one step
Trait Implementations§
Source§impl<State: Clone + DecompositionState, const RANK: usize> Clone for TypeSafePCA<State, RANK>
impl<State: Clone + DecompositionState, const RANK: usize> Clone for TypeSafePCA<State, RANK>
Source§fn clone(&self) -> TypeSafePCA<State, RANK>
fn clone(&self) -> TypeSafePCA<State, RANK>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const RANK: usize> ComponentAccess<RANK> for TypeSafePCA<Fitted, RANK>
impl<const RANK: usize> ComponentAccess<RANK> for TypeSafePCA<Fitted, RANK>
Source§impl<State: Debug + DecompositionState, const RANK: usize> Debug for TypeSafePCA<State, RANK>
impl<State: Debug + DecompositionState, const RANK: usize> Debug for TypeSafePCA<State, RANK>
Source§impl<State: DecompositionState, const RANK: usize> TypeSafeDecomposition<State> for TypeSafePCA<State, RANK>
impl<State: DecompositionState, const RANK: usize> TypeSafeDecomposition<State> for TypeSafePCA<State, RANK>
Auto Trait Implementations§
impl<State, const RANK: usize> Freeze for TypeSafePCA<State, RANK>
impl<State, const RANK: usize> RefUnwindSafe for TypeSafePCA<State, RANK>where
State: RefUnwindSafe,
impl<State, const RANK: usize> Send for TypeSafePCA<State, RANK>where
State: Send,
impl<State, const RANK: usize> Sync for TypeSafePCA<State, RANK>where
State: Sync,
impl<State, const RANK: usize> Unpin for TypeSafePCA<State, RANK>where
State: Unpin,
impl<State, const RANK: usize> UnwindSafe for TypeSafePCA<State, RANK>where
State: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more