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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create EventTransform #14

Closed
1 task
Mr-Geekman opened this issue Aug 14, 2023 · 0 comments 路 Fixed by #78
Closed
1 task

Create EventTransform #14

Mr-Geekman opened this issue Aug 14, 2023 · 0 comments 路 Fixed by #78
Assignees
Labels
enhancement New feature or request priority/medium Medium priority task

Comments

@Mr-Geekman
Copy link

Issue by iKintosh
Tuesday Jun 21, 2022 at 07:33 GMT
Originally opened as tinkoff-ai#765


馃殌 Feature Request

ETNA should have transform that allows to mark days before and after event (holiday, promo or else)

Motivation

Now we ought to manually create such features. It is not convinient.

Proposal

Add an EventTransform with init parameters:

  • in_column: str binary column with event indicator,
  • out_column: str base for creating out columns names,
  • n_pre: int default 1, number of days before the event to react ,
  • n_post: int default 1, number of days after the event to react,
  • mode: str, default binary, possible values:
    • binary: the created columns are binary ,
    • distance: the created columns show distance to the closest true value.

This transform creates two columns: {out_column}_pre, {out_column}_post. First column is dealing with reaction to the event before it started, the second is dealing with reaction after event has ended.

Let's explain modes of operation:

  • In binary mode pre column shows value to 1 if the distance to the closest event in the future is in [1, n_pre], otherwise shows 0.
  • In distance mode pre column shows 1/distance to the closest event in the future if the distance is in [1, n_pre], otherwise shows 0.
  • In binary mode post column changes its value to 1 if the distance to the closest event in the past is in [1, n_post], otherwise shows 0.
  • In distance mode post column shows 1/distance to the closest event in the past if the distance is in [1, n_post], otherwise shows 0.

In params to tune we should tune:

  • n_pre: from 1 to the n_pre set by user,
  • n_post: from 1 to the n_post set by user,
  • mode: both possible values.

Implement get_regressors_info:

  • If column is regressor, out_column will be regressor;
  • Otherwise, out_column isn't regressor.

Example:

EventTransform(in_column="holiday", prev=2, post=2)
holiday 0 0 1 1 1 0 0
holiday_prev 1 1 0 0 0 0 0
holiday_post 0 0 0 0 0 1 1

Test cases

  • Add tests on transform, pay attention to
    • Validation of input column
    • Different modes of operation
    • Events with space < n_pre or n_post between them
  • Add inference tests for this transform into tests/test_transforms/test_inference

Alternatives

No response

Additional context

No response

Checklist

  • I discussed this issue with ETNA Team
@Mr-Geekman Mr-Geekman added enhancement New feature or request priority/medium Medium priority task labels Aug 14, 2023
@egoriyaa egoriyaa self-assigned this Sep 6, 2023
@egoriyaa egoriyaa mentioned this issue Sep 7, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority/medium Medium priority task
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants