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

add window size selector #1237

Merged
merged 23 commits into from
Jan 4, 2024
Merged

add window size selector #1237

merged 23 commits into from
Jan 4, 2024

Conversation

kasyanovse
Copy link
Collaborator

@kasyanovse kasyanovse commented Dec 27, 2023

Method from #1186.

  1. Add window size auto selection for lagged node.
  2. Reduce probability of lagged window mutation.
    Without window size auto selection window mutation is very usefull, it ups pipeline in sorted by fitness population up to 0.2 of quantile value, but with auto selection it downs pipeline up to 0.12 of quantile value. Therefore, window tuning by mutation is bad for pipeline. For additional information see tables in : Atomized model operation #1227.

@kasyanovse kasyanovse added enhancement New feature or request time series related to time series processing labels Dec 27, 2023
@pep8speaks
Copy link

pep8speaks commented Dec 27, 2023

Hello @kasyanovse! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2024-01-04 08:42:06 UTC

@kasyanovse kasyanovse mentioned this pull request Dec 27, 2023
19 tasks
Copy link

codecov bot commented Dec 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (299ffba) 79.47% compared to head (fe4d61a) 79.93%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1237      +/-   ##
==========================================
+ Coverage   79.47%   79.93%   +0.46%     
==========================================
  Files         145      145              
  Lines        9928     9945      +17     
==========================================
+ Hits         7890     7950      +60     
+ Misses       2038     1995      -43     

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

@kasyanovse kasyanovse marked this pull request as ready for review December 27, 2023 08:43
@kasyanovse kasyanovse linked an issue Dec 27, 2023 that may be closed by this pull request
Copy link
Collaborator

@valer1435 valer1435 left a comment

Choose a reason for hiding this comment

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

В теории ок, выглядит достаточно лаконично. Но есть вопросы:

  1. Сейчас подбор окна происходит при каждом вызове transform. впринципе ок, думаю можно оставить подбор для каждого фолда, но не слишеом ли то долго?
  2. Как-то можно посмотреть настоящую длину окна, а не параметр 0?
  3. Как проверял эффективность? Действительно ли стало лучше?

@kasyanovse
Copy link
Collaborator Author

kasyanovse commented Dec 27, 2023

  1. Сейчас подбор окна происходит при каждом вызове transform. впринципе ок, думаю можно оставить подбор для каждого фолда, но не слишеом ли то долго?

Почему при каждом вызове? Я сейчас посмотрел, после выбора параметры сохраняются в узле.

  1. Как-то можно посмотреть настоящую длину окна, а не параметр 0?

Да, в lagged хранится настоящая длина окна после обучения.

  1. Как проверял эффективность? Действительно ли стало лучше?

#1227 в описании PR есть таблички с оценкой изменения положения пайплайна внутри поколения после мутации.

@valer1435
Copy link
Collaborator

Кстати тюнер будет игнорировать длину окна или нет?

@kasyanovse
Copy link
Collaborator Author

Кстати тюнер будет игнорировать длину окна или нет?

Не будет. Он как раз и дотюнивает окно после композиции.

@@ -103,7 +105,7 @@ def transform_for_fit(self, input_data: InputData) -> OutputData:
self._update_column_types(output_data)
return output_data

def _check_and_correct_window_size(self, time_series: np.array, forecast_length: int):
def _check_and_correct_window_size(self, time_series: np.ndarray, forecast_length: int):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Я про то, это этот метод вызывается в transform и transform_for_fit

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Окно подстраивается только если оно по дефолту не задано. Если задать его руками или изменить в процессе композиции/тюнинга, то оно не будет переопределяться.

Copy link
Collaborator

Choose a reason for hiding this comment

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

То есть сейчас это работает так:

  1. Дефолтное значение длины окна 0.
  2. Пусть у нас 3 фолда валидации
  3. Заходим в первый фолд, подбираем длину окна
  4. На следующих фолдах и при финальном обучении на всем ряду размер окна не подбираем?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Добавил тесты что при вычислении графа на фолдах и внутри тюнера окно не перенастраивается.



def test_tuner_correctly_work_with_window_size_selector():
ts = get_timeseries(length=1000, random=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Не много данных для теста?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Чтобы автовыбор окна случайно не совпал с тюнером им нужна некоторая свобода выбора.

Copy link
Collaborator

@valer1435 valer1435 Dec 28, 2023

Choose a reason for hiding this comment

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

А по времени сколько работает? Я апрувну, но если тест работает дольше 2-3 секунд, стоит урезать

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

test_time_series_operations.py у меня на компе за 1,5 секунды выполняется.

@valer1435 valer1435 self-requested a review December 28, 2023 14:44
@kasyanovse kasyanovse merged commit db6e3be into master Jan 4, 2024
6 of 9 checks passed
@kasyanovse kasyanovse deleted the add-lagged-window-size-selector branch January 17, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request time series related to time series processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automated window size selection
3 participants