pca_explained_variance
std.stats.pca_explained_variance · Level L3Principal component analysis, as the share of variance along each principal axis, largest first: the eigenvalues of the covariance matrix over their sum.
λᵢ(C) / Σⱼ λⱼ(C), C = (X − X̄)ᵀ(X − X̄)/n
Signature
pca_explained_variance(X: f64[n, p]) → f64[p]
Requires: n ≥ 2
Structure
The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.
- input
- operation
- constant
- call
- output
Verification
- Signature proven by NOVA’s shape solver, for every size with n ≥ 2.
- Agrees with the reference
eigvalsh(cov(X))[::-1] / sumto 80 digits (100-digit arithmetic), on all 40 test cases. - All 148 float64 results inside the running error bound; the closest uses 10% of it.
- Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
- correctly rounded (the float64 nearest the exact value)
- 22%
- bit-equal to the NumPy formula in float64
- 22%
- largest error, in units in the last place
- 1.1e+307
Large ulp counts appear where a result is zero or tiny next to the numbers it is computed from (after cancellation, for example), so one unit in the last place is tiny too; the absolute error is still inside the bound.
Identity
Calls
—
Called by
—
sha256:03ac2415a36d8ccf92f0509d8b5c6922e664d9bbbfefd1cd36340ab7d333eb7aThe semantic hash of the graph. It changes when the program changes, and never when only its documentation does.