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

Parallelize the fit and decision_function methods of FeatureBagging #197

Open
wants to merge 6 commits into
base: development
Choose a base branch
from

Conversation

Shihab-Shahriar
Copy link

This PR Parallelize the fit and decision_function methods of FeatureBagging. The earlier implementation only used the n_jobs when base_estimator parameter is None. Apart from fixing that, the model level PR enables parallelism at more coarser level, thereby noticeably improving performance.

Benchmark results using n_estimators=20 and base_estimator=None, averaged over 3 runs. Values indicate fit time in seconds, the one inside bracket denote time for decision_function:

Dataset (shape) Orig (n_jobs=1) Orig (n_jobs=4) This PR (n_jobs=4)
pima (768, 8) 0.19 (0.094) 2.30 (2.155) 0.64 (0.63)
vowels (1456, 12) 0.71 (0.42) 2.36 (2.17) 0.66 (0.64)
pendigits (6870, 16) 9.12 (5.02) 5.87 (4.32) 1.78 (1.42)
musk (3062, 166) 18.92 (8.32) 7.46 (5.88) 3.90 (2.79)
shuttle (49097, 9) 59.09 (38.67) 46.10 (28.11) 33.43 (18.01)

Performance can be slightly worse than single-process method for smaller datasets, but I think that is expected.

Please let me know if further changes are needed. Thanks.

@coveralls
Copy link

coveralls commented May 24, 2020

Pull Request Test Coverage Report for Build 1512

  • 51 of 52 (98.08%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 95.819%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pyod/models/feature_bagging.py 31 32 96.88%
Totals Coverage Status
Change from base Build 1507: 0.2%
Covered Lines: 4423
Relevant Lines: 4616

💛 - Coveralls

@Shihab-Shahriar
Copy link
Author

CC @yzhao062 for comments, in case you've accidentally missed it, I hope it's ok.

@yzhao062
Copy link
Owner

Sorry for being late. this will be the next PR to be in. It looks nice to me. Just need to run some test locally :) hang in there. Thanks!

@Shihab-Shahriar
Copy link
Author

CC @yzhao062

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.

None yet

3 participants