From 0ade7941c5d6e083ec74fcd6903f5f023c11d978 Mon Sep 17 00:00:00 2001 From: Hamish Scott <41787553+hamishs@users.noreply.github.com> Date: Sat, 13 Jan 2024 14:39:08 +0000 Subject: [PATCH] Expose references to the PCA components and column means (#327) --- algorithms/linfa-reduction/src/pca.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/algorithms/linfa-reduction/src/pca.rs b/algorithms/linfa-reduction/src/pca.rs index c2e31213b..87d162f7e 100644 --- a/algorithms/linfa-reduction/src/pca.rs +++ b/algorithms/linfa-reduction/src/pca.rs @@ -176,6 +176,16 @@ impl Pca { ex_var / sum_ex_var } + /// Return the components + pub fn components(&self) -> &Array2 { + &self.embedding + } + + /// Return the mean + pub fn mean(&self) -> &Array1 { + &self.mean + } + /// Return the singular values pub fn singular_values(&self) -> &Array1 { &self.sigma