pub struct FactorAnalysis { /* private fields */ }Expand description
Factor Analysis for dimensionality reduction
Factor Analysis assumes observed data is generated from a linear model with latent factors plus Gaussian noise with feature-specific variances.
§Example
use scirs2_transform::reduction::factor_analysis::FactorAnalysis;
use scirs2_core::ndarray::Array2;
let data = Array2::<f64>::zeros((100, 10));
let mut fa = FactorAnalysis::new(3);
let result = fa.fit_transform(&data).expect("fit_transform failed");
println!("Loadings shape: {:?}", result.loadings.shape());
println!("Scores shape: {:?}", result.scores.shape());Implementations§
Source§impl FactorAnalysis
impl FactorAnalysis
Sourcepub fn with_rotation(self, rotation: RotationMethod) -> Self
pub fn with_rotation(self, rotation: RotationMethod) -> Self
Set the rotation method
Sourcepub fn with_max_iter(self, max_iter: usize) -> Self
pub fn with_max_iter(self, max_iter: usize) -> Self
Set the maximum number of EM iterations
Sourcepub fn with_promax_power(self, power: usize) -> Self
pub fn with_promax_power(self, power: usize) -> Self
Set the promax power parameter
Sourcepub fn with_center(self, center: bool) -> Self
pub fn with_center(self, center: bool) -> Self
Set whether to center the data
Sourcepub fn fit_transform<S>(
&mut self,
x: &ArrayBase<S, Ix2>,
) -> Result<FactorAnalysisResult>
pub fn fit_transform<S>( &mut self, x: &ArrayBase<S, Ix2>, ) -> Result<FactorAnalysisResult>
Sourcepub fn uniquenesses(&self) -> Option<&Array1<f64>>
pub fn uniquenesses(&self) -> Option<&Array1<f64>>
Returns the uniquenesses
Sourcepub fn scree_plot_data<S>(
x: &ArrayBase<S, Ix2>,
use_correlation: bool,
) -> Result<ScreePlotData>
pub fn scree_plot_data<S>( x: &ArrayBase<S, Ix2>, use_correlation: bool, ) -> Result<ScreePlotData>
Compute scree plot data from a data matrix
Computes eigenvalues of the covariance (or correlation) matrix, which can be used for scree plots to determine the number of factors.
§Arguments
x- Input data, shape (n_samples, n_features)use_correlation- If true, use the correlation matrix instead of covariance
§Returns
Result<ScreePlotData>- Eigenvalues and variance proportions
Trait Implementations§
Source§impl Clone for FactorAnalysis
impl Clone for FactorAnalysis
Source§fn clone(&self) -> FactorAnalysis
fn clone(&self) -> FactorAnalysis
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 moreAuto Trait Implementations§
impl Freeze for FactorAnalysis
impl RefUnwindSafe for FactorAnalysis
impl Send for FactorAnalysis
impl Sync for FactorAnalysis
impl Unpin for FactorAnalysis
impl UnsafeUnpin for FactorAnalysis
impl UnwindSafe for FactorAnalysis
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.