pca_explained_variance

std.stats.pca_explained_variance · Level L3

Principal 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.

Xf64[n, p]MeanmuSizenSubtractXcTransposeXctMatMulC0DivideCEighValueswSortwdReduceSumtotalDivideratioratiof64[p]
  • 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] / sum to 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.7e+13

Large ulp counts appear where a result is 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. Results within their own error of zero are not counted.

Identity

Calls
—
Called by
—
sha256:03ac2415a36d8ccf92f0509d8b5c6922e664d9bbbfefd1cd36340ab7d333eb7a

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.

Control handle

Symbol
Ω:std.stats.pca_explained_variance · Ω:pca_explained_variance
Pins
sha256:edee9eacf98bc59f84fa5259b901bfff5c390ca5756c2a8268425774835f25a5this graph alone
Evidence
sha256:8122db11946bc4d2083f1326cc70d153364322dd499152302f57e59841773017the hash of its verification record
Needs
no capability: a pure function

Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.