pub struct FittedLDA<F> { /* private fields */ }Expand description
A fitted LDA model.
Created by calling Fit::fit on an LDA. Implements:
Transform<Array2<F>>— project data onto discriminant axes.Predict<Array2<F>>— classify by nearest centroid in projected space.
Implementations§
Source§impl<F: Float + Send + Sync + 'static> FittedLDA<F>
impl<F: Float + Send + Sync + 'static> FittedLDA<F>
Sourcepub fn scalings(&self) -> &Array2<F>
pub fn scalings(&self) -> &Array2<F>
Projection (scalings) matrix, shape (n_features, n_components).
Sourcepub fn means(&self) -> &Array2<F>
pub fn means(&self) -> &Array2<F>
Class centroids in the projected space, shape (n_classes, n_components).
Sourcepub fn explained_variance_ratio(&self) -> &Array1<F>
pub fn explained_variance_ratio(&self) -> &Array1<F>
Explained-variance ratio per discriminant direction.
Trait Implementations§
Source§impl<F: Float + Send + Sync + 'static> Predict<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedLDA<F>
impl<F: Float + Send + Sync + 'static> Predict<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedLDA<F>
Source§fn predict(&self, x: &Array2<F>) -> Result<Array1<usize>, FerroError>
fn predict(&self, x: &Array2<F>) -> Result<Array1<usize>, FerroError>
Classify samples by nearest centroid in the projected space.
§Errors
Returns FerroError::ShapeMismatch if the number of features does not
match the model.
Source§type Output = ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>
type Output = ArrayBase<OwnedRepr<usize>, Dim<[usize; 1]>>
The prediction output type (e.g.,
ndarray::Array1<F> or ndarray::Array1<usize>).Source§type Error = FerroError
type Error = FerroError
The error type returned by
predict.Source§impl<F: Float + Send + Sync + 'static> Transform<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedLDA<F>
impl<F: Float + Send + Sync + 'static> Transform<ArrayBase<OwnedRepr<F>, Dim<[usize; 2]>>> for FittedLDA<F>
Source§fn transform(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
fn transform(&self, x: &Array2<F>) -> Result<Array2<F>, FerroError>
Project x onto the discriminant axes: X @ scalings.
§Errors
Returns FerroError::ShapeMismatch if x.ncols() does not match the
number of features seen during fitting.
Source§type Error = FerroError
type Error = FerroError
The error type returned by
transform.Auto Trait Implementations§
impl<F> Freeze for FittedLDA<F>
impl<F> RefUnwindSafe for FittedLDA<F>where
F: RefUnwindSafe,
impl<F> Send for FittedLDA<F>where
F: Send,
impl<F> Sync for FittedLDA<F>where
F: Sync,
impl<F> Unpin for FittedLDA<F>
impl<F> UnsafeUnpin for FittedLDA<F>
impl<F> UnwindSafe for FittedLDA<F>where
F: RefUnwindSafe,
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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