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

Speed up ContextualCountEmbedder operation #363

Merged
merged 4 commits into from
Oct 18, 2023

Conversation

RaczeQ
Copy link
Collaborator

@RaczeQ RaczeQ commented Oct 11, 2023

Refactored srai.embedders.contextual_count_embedder by removing for loop over all dataframe rows with loc replacement.

Whole operation is now vectorized and works on numpy arrays.

Common code for squashed and concatenated version of the embedder has been extracted to the new function _get_averaged_values_for_distances.

@RaczeQ RaczeQ linked an issue Oct 11, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Oct 11, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (1cd0f13) 92.08% compared to head (2306b2a) 91.92%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #363      +/-   ##
==========================================
- Coverage   92.08%   91.92%   -0.17%     
==========================================
  Files          60       60              
  Lines        2211     2203       -8     
==========================================
- Hits         2036     2025      -11     
- Misses        175      178       +3     
Flag Coverage Δ
macos-latest-python3.11 91.92% <100.00%> (-0.17%) ⬇️
ubuntu-latest-python3.10 91.82% <100.00%> (-0.17%) ⬇️
ubuntu-latest-python3.11 91.92% <100.00%> (-0.17%) ⬇️
ubuntu-latest-python3.8 91.85% <100.00%> (-0.08%) ⬇️
ubuntu-latest-python3.9 91.76% <100.00%> (-0.26%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
srai/embedders/contextual_count_embedder.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

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

@RaczeQ RaczeQ added the hacktoberfest-accepted This pull request is accepted in Hacktoberfest label Oct 11, 2023
@RaczeQ RaczeQ merged commit f5b091c into main Oct 18, 2023
11 checks passed
@RaczeQ RaczeQ deleted the 359-speed-up-contextual-count-embedder-operation branch October 18, 2023 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted This pull request is accepted in Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Speed up contextual count embedder operation
2 participants