ComponentChooser
- class lightning_pose.utils.pca.ComponentChooser[source]
Bases:
objectDetermine the number of PCA components to keep.
Attributes Summary
Cumulative sum of the explained variance ratios of the fitted PCA object.
Methods Summary
__call__()Return the number of PCA components to retain.
Attributes Documentation
- cumsum_explained_variance
Cumulative sum of the explained variance ratios of the fitted PCA object.
- Returns:
1-D array where index
iis the fraction of variance explained by the firsti+1components.
Methods Documentation
- __call__() int[source]
Return the number of PCA components to retain.
- Returns:
Integer number of components.
- Raises:
TypeError – if
self.components_to_keepis neitherintnorfloat.
- __init__(fitted_pca_object: PCA, components_to_keep: int | float | None) None[source]
Initialize ComponentChooser.
- Parameters:
fitted_pca_object – a fitted
sklearn.decomposition.PCAorNaNPCAinstance whoseexplained_variance_ratio_attribute is used to select the number of components.components_to_keep – criterion for selecting components. An
intreturns that exact count; afloatin[0, 1]returns the minimum number of components needed to reach that cumulative explained-variance threshold;Nonekeeps all components.
- __new__(**kwargs)