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

Lagged implementation speedup #1139

Merged
merged 3 commits into from
Aug 10, 2023
Merged

Conversation

kasyanovse
Copy link
Collaborator

@kasyanovse kasyanovse commented Aug 10, 2023

One line in code in lagged implementation spends more than 95% of lagged implementation evaluation time (in my case).
Fixed it.

@nicl-nno
Copy link
Collaborator

А есть оценка насколько это ускоряет?

@kasyanovse
Copy link
Collaborator Author

kasyanovse commented Aug 10, 2023

Тесты на произвольных данных. исправленный код находится в функции prepare_target.

Старый вариант.
image

Новый вариант.
image

@codecov
Copy link

codecov bot commented Aug 10, 2023

Codecov Report

Merging #1139 (9410f15) into master (8f1dcd7) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1139   +/-   ##
=======================================
  Coverage   78.53%   78.53%           
=======================================
  Files         131      131           
  Lines        9359     9360    +1     
=======================================
+ Hits         7350     7351    +1     
  Misses       2009     2009           
Files Changed Coverage Δ
...lementations/data_operations/ts_transformations.py 78.42% <100.00%> (+0.05%) ⬆️

@nicl-nno
Copy link
Collaborator

Здорово! Да наверное в тесте нет нужды, время сложно оценивать.

@@ -841,7 +841,8 @@ def prepare_target(all_idx, idx, features_columns: np.array, target, forecast_le
idx = idx[: -1]

# Update target (clip first "window size" values)
row_nums = [list(all_idx).index(i) for i in idx]
index_hash_table = {val: i for i, val in enumerate(all_idx)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Можешь оставить в комментарии пометку что такая реализация критична для производительности.

@kasyanovse kasyanovse merged commit 4200b4e into master Aug 10, 2023
5 checks passed
@kasyanovse kasyanovse deleted the optimize-lagged-implementation branch August 11, 2023 06:51
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