Conversation
Replace the sklearn PCA and StandardScaler in Correlation.plot_pca with a scipy/numpy SVD implementation, reproducing sklearn's output (column standardization with population std, deterministic svd_flip sign convention, explained_variance_ from singular values). Drop the now-unused pandas and scikit-learn dependencies. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…CA tests The scipy/SVD PCA rewrite inherited three pre-existing plot_pca bugs from the sklearn version: - --transpose crashed with a shape mismatch (np.dot(m, Wt.T)); U*S already gives sample projections, so orient as (components, samples) via Wt.T. - --log2 / --rowCenter were no-ops: they mutated self.matrix after m had been copied during ntop filtering. Now applied to a float copy before variance filtering. - --ntop below the sample count crashed the scatter with IndexError; guard with a clear sys.exit instead. Adds test_plotPCA.py coverage (sign-invariant coordinate/eigenvalue regressions, ntop behavior, transpose, CLI validation exits) that passes against both the sklearn and scipy implementations.
Added PCA test coverage + fixed three inherited
|
# Conflicts: # pydeeptools/deeptools/test/test_plotPCA.py
test_plotPCA_default_coordinates failed on macOS CI: after PC1 the untransposed eigenvalues are near-degenerate, so the eigenvectors rotate freely and np.argpartition breaks top-ntop variance ties differently on Accelerate vs OpenBLAS, making per-feature coordinates non-reproducible. Replace it with test_plotPCA_default_eigenvalues, asserting only the portable eigenvalues; coordinate-level regression stays covered by the well-separated transpose case (test_plotPCA_transpose).
Replace the sklearn PCA and StandardScaler in Correlation.plot_pca with a scipy/numpy SVD implementation, reproducing sklearn's output (column standardization with population std, deterministic svd_flip sign convention, explained_variance_ from singular values). Drop the now-unused pandas and scikit-learn dependencies.