Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use scipy's decompositions in PCA. #1080

Merged
merged 4 commits into from
Mar 31, 2024

Conversation

fkdosilovic
Copy link
Contributor

@fkdosilovic fkdosilovic commented Jan 20, 2024

Description

Use scipy's decompositions in PCA.

Related issues or pull requests

Fixes #1078

Pull Request Checklist

  • Added a note about the modification or contribution to the ./docs/sources/CHANGELOG.md file (if applicable)
  • Added appropriate unit test functions in the ./mlxtend/*/tests directories (if applicable)
  • Modify documentation in the corresponding Jupyter Notebook under mlxtend/docs/sources/ (if applicable)
  • Ran PYTHONPATH='.' pytest ./mlxtend -sv and make sure that all unit tests pass (for small modifications, it might be sufficient to only run the specific test file, e.g., PYTHONPATH='.' pytest ./mlxtend/classifier/tests/test_stacking_cv_classifier.py -sv)
  • Checked for style issues by running flake8 ./mlxtend

@fkdosilovic
Copy link
Contributor Author

Benchmark code and results:

Results on AMD Ryzen 5 5625U with 6 cores (12 threads):

Timings are reported in seconds. Each experiment was run 10 times.

method shape avg std min max
numpy.linalg.svd (10, 10) 0.00 0.00 0.00 0.00
(100, 100) 0.00 0.00 0.00 0.01
(500, 500) 0.05 0.01 0.04 0.07
(1000, 1000) 0.23 0.02 0.21 0.27
(5000, 1000) 4.07 0.15 3.90 4.39
scipy.linalg.svd (10, 10) 0.00 0.00 0.00 0.00
(100, 100) 0.00 0.00 0.00 0.01
(500, 500) 0.04 0.00 0.04 0.05
(1000, 1000) 0.20 0.01 0.19 0.23
(5000, 1000) 3.92 0.14 3.80 4.25

scipy v1.11.4 and numpy v1.26.3

Copy link

codecov bot commented Mar 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.32%. Comparing base (8592cc7) to head (f61c01c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1080      +/-   ##
==========================================
- Coverage   78.34%   78.32%   -0.02%     
==========================================
  Files         196      196              
  Lines       11157    11158       +1     
  Branches     1404     1404              
==========================================
- Hits         8741     8740       -1     
- Misses       2199     2200       +1     
- Partials      217      218       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@rasbt rasbt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for the PR (and sorry for the delay!)

@rasbt rasbt merged commit 63a2655 into rasbt:master Mar 31, 2024
3 of 4 checks passed
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.

Use SciPy SVD instead of NumPy SVD.
2 participants