Expand description
§Dimensionality Reducer
PCA-based dimensionality reduction for embedding vectors. Implements power-iteration PCA for top-k eigenvector extraction, plus a thin Truncated SVD wrapper.
§Algorithm
- Center the data (subtract column means).
- Compute the covariance matrix.
- Use power iteration with deflation to extract the top-k eigenvectors.
- Project data onto the component subspace.
Structs§
- PcaReducer
- PCA dimensionality reducer using power-iteration eigenvector extraction.
- Reduction
Result - Output of a
fit_transformcall. - Truncated
Svd - Truncated SVD: operates on the raw (uncentered) data matrix.
Enums§
- Reduction
Error - Errors from dimensionality reduction operations.
Functions§
- center_
data - Center the data by subtracting column means.
Returns
(centered_data, column_means). - dot_
product - Compute the dot product of two equal-length slices.
- mat_
vec_ mul - Multiply matrix
mat(m × n) by vectorvec(n) → result (m). - normalize
- Normalise a vector in-place (L2 norm). No-op for zero vectors.