Skip to content

Commit

Permalink
fix images pca II
Browse files Browse the repository at this point in the history
  • Loading branch information
lillianw101 committed Apr 19, 2024
1 parent 5e8873b commit 8b3fbea
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 1 deletion.
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion pca_2/pca_2.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ $$ \text{component score} = \frac{s_i^{2}}{N}$$

$$ \text{total variance} = \text{sum of all the component scores} = \sum\_{i=1}^k \frac{s_i^{2}}{N} $$

$$ \text{variance ratio of principal component i} = \frac{\text{component score i}}{\text{total variance}} = \frac{s*i^{2} / N}{\sum*{i=1}^k s_i^{2} / N}$$
$$ \text{variance ratio of principal component j} = \frac{\text{component score j}}{\text{total variance}} = \frac{s_j^{2} / N}{\sum_{i=1}^k s_i^{2} / N}$$

In Python, assuming you had a 1D `NumPy` array of singular values `s` returned by `np.linalg.svd`, you could compute the list of variances ratios with `s**2 / sum(s**2)`.

Expand Down

0 comments on commit 8b3fbea

Please sign in to comment.