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

Optimize nested loop efficiency in the Anomaly Attention class #63

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anilcanbulut
Copy link

@anilcanbulut anilcanbulut commented Dec 29, 2023

Refactored the existing nested loop structure within the Anomaly Attention class used for finding the distance between the indexes. Replaced the original dual for-loops, which scaled with window size, with a more efficient implementation.

Performance Improvement:

  • Original execution time for a window size of 250: ~50 seconds.
  • New execution time for the same window size: ~0.01 seconds.

I was experimenting with different window sizes to see their effects on my dataset. However, in my current setup where I use a high-performance workstation, it started to take too much time when I increased the window size. This new approach takes much more lower time to achieve the same matrix.

Refactored the existing nested loop structure within the Anomaly Attention class used for finding the distance between the indexes. Replaced the original dual for-loops, which scaled with window size, with a more efficient implementation.

Performance Improvement:
- Original execution time for a window size of 250: ~50 seconds.
- New execution time for the same window size: ~0.01 seconds.

This enhancement significantly boosts the model's performance, especially for larger window sizes, making it more practical for use in high-performance environments.
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.

1 participant