pub struct ComponentVisualization {
pub loadings: Array2<Float>,
pub scores: Array2<Float>,
pub explained_variance: Array1<Float>,
pub explained_variance_ratio: Array1<Float>,
pub feature_names: Option<Vec<String>>,
pub component_names: Option<Vec<String>>,
}Expand description
Component visualization data structure
Fields§
§loadings: Array2<Float>Component loadings/weights
scores: Array2<Float>Component scores (transformed data)
explained_variance: Array1<Float>Explained variance for each component
explained_variance_ratio: Array1<Float>Explained variance ratio for each component
feature_names: Option<Vec<String>>Feature names (optional)
component_names: Option<Vec<String>>Component names (optional)
Implementations§
Source§impl ComponentVisualization
impl ComponentVisualization
Sourcepub fn new(
loadings: Array2<Float>,
scores: Array2<Float>,
explained_variance: Array1<Float>,
) -> Self
pub fn new( loadings: Array2<Float>, scores: Array2<Float>, explained_variance: Array1<Float>, ) -> Self
Create a new ComponentVisualization
Sourcepub fn with_feature_names(self, names: Vec<String>) -> Self
pub fn with_feature_names(self, names: Vec<String>) -> Self
Set feature names
Sourcepub fn with_component_names(self, names: Vec<String>) -> Self
pub fn with_component_names(self, names: Vec<String>) -> Self
Set component names
Sourcepub fn loading_plot_data(
&self,
comp1: usize,
comp2: usize,
) -> Result<LoadingPlotData>
pub fn loading_plot_data( &self, comp1: usize, comp2: usize, ) -> Result<LoadingPlotData>
Get loading plot data for specified components
Sourcepub fn biplot_data(&self, comp1: usize, comp2: usize) -> Result<BiplotData>
pub fn biplot_data(&self, comp1: usize, comp2: usize) -> Result<BiplotData>
Generate biplot data combining scores and loadings
Sourcepub fn feature_importance(&self) -> Array2<Float>
pub fn feature_importance(&self) -> Array2<Float>
Calculate feature importance for each component
Sourcepub fn top_features_per_component(
&self,
n_features: usize,
) -> Vec<Vec<FeatureImportance>>
pub fn top_features_per_component( &self, n_features: usize, ) -> Vec<Vec<FeatureImportance>>
Get the most important features for each component
Sourcepub fn component_contributions(&self) -> ComponentContribution
pub fn component_contributions(&self) -> ComponentContribution
Calculate component contribution to total variance
Sourcepub fn scree_plot_data(&self) -> ScreePlotData
pub fn scree_plot_data(&self) -> ScreePlotData
Generate scree plot data (eigenvalues vs component number)
Sourcepub fn optimal_components(&self) -> OptimalComponentsAnalysis
pub fn optimal_components(&self) -> OptimalComponentsAnalysis
Find optimal number of components using various criteria
Trait Implementations§
Source§impl Clone for ComponentVisualization
impl Clone for ComponentVisualization
Auto Trait Implementations§
impl Freeze for ComponentVisualization
impl RefUnwindSafe for ComponentVisualization
impl Send for ComponentVisualization
impl Sync for ComponentVisualization
impl Unpin for ComponentVisualization
impl UnsafeUnpin for ComponentVisualization
impl UnwindSafe for ComponentVisualization
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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