Skip to content

Conversation

@achenzion
Copy link
Collaborator

@achenzion achenzion commented Sep 1, 2025

Set up SVD method comparison

scipy seems slightly faster than numpy

mlpack does not support an option that outputs the singular values in the python binding

Equivalent would be the raw C++
arma::svd(U, s, V, A)
but does not seem to have a python API equivalent (i think)
https://github.com/mlpack/mlpack/blob/master/src/mlpack/methods/cf/svd_wrapper.hpp

@achenzion
Copy link
Collaborator Author

Also worth considering others who have done the binding at least for POC (pyarma doesn't seem to have recent updates)

PyArmadillo: linear algebra library for Python https://pyarma.sourceforge.io/docs.html#svd

@achenzion
Copy link
Collaborator Author

Another alternative is to use algos that are slight approximations and/ir truncated to top N values (where you set N large enough for it not to practically bind)

For example randomized_svd https://scikit-learn.org/stable/modules/generated/sklearn.utils.extmath.randomized_svd.html randomized_svd — scikit-learn 1.7.1 documentation

@achenzion
Copy link
Collaborator Author

Paper reference on an alt algo https://arxiv.org/pdf/1704.05528

@achenzion
Copy link
Collaborator Author

Cvopt inspiration. Nuclear norm approximation — CVXOPT https://cvxopt.org/applications/nucnrm/index.html

@achenzion
Copy link
Collaborator Author

Another alternative is to use algos that are slight approximations and/ir truncated to top N values (where you set N large enough for it not to practically bind)

For example randomized_svd https://scikit-learn.org/stable/modules/generated/sklearn.utils.extmath.randomized_svd.html randomized_svd — scikit-learn 1.7.1 documentation

More general to just use TruncatedSVD — scikit-learn 1.7.1 documentation https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.TruncatedSVD.html

@achenzion achenzion marked this pull request as ready for review September 2, 2025 02:15
@achenzion achenzion requested a review from apoorvalal September 2, 2025 02:15
@achenzion
Copy link
Collaborator Author

Note R version uses eigen. One option is to pybind (instead of R bind) everything already there directly https://github.com/susanathey/MCPanel/blob/master/src/mcnnm_R.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants