Skip to content

[DRAFT]Make base class of Transforms work with TSDataset #797

Closed
alex-hse-repository opened this issue Jul 14, 2022 · 1 comment · Fixed by #835
Closed

[DRAFT]Make base class of Transforms work with TSDataset #797

alex-hse-repository opened this issue Jul 14, 2022 · 1 comment · Fixed by #835
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@alex-hse-repository
Copy link
Collaborator

alex-hse-repository commented Jul 14, 2022

🚀 Feature Request

We need to teach our transforms work with dataset instead of dataframe

Proposal

  1. In Transform:
  • Add method get_regressors_info() -> List[str]`

    • Return the list with added regressors
    • In default implementation returns []
  • Create method update_dataset(ts: TSDataset, df: pd.DataFrame, df_transformed: pd.DataFrame)

    • Add/update columns in ts using update_columns_from_pandas, if len(df.columns) <= len(df_transformed.columns)
    • Remove columns from ts using remove_columns, if len(df.columns) > len(df_transformed.columns)
    • Use the method get_regressors_info to get the information about the regressors if necessary
  • Create method fit(self, ts: TSDataset):

    • Make the current method private _fit(df: pd.DataFrame)
    • Get the dataframe with necessary columns form ts using method to_pandas
    • Use method _fit to fit the transform with this dataframe
  • Create method transform(self, ts: TSDataset):

    • Make the current method private _transform(df: pd.DataFrame)
    • Get the dataframe with necessary columns form ts using method to_pandas
    • Use method _transform to transform this dataframe
    • Use method update_dataset to update the columns in the dataset
  • Create method inverse_transform(self, ts: TSDataset):

    • Make the current method private _inverse_transform(df: pd.DataFrame)
    • Get the dataframe with necessary columns form ts using method to_pandas
    • Use method _inverse_transform to transform this dataframe
    • Use method update_dataset to update the columns in the dataset
  1. In TSDataset:
  • Fix all the places, where the transforms are called, now we need to pass self instead of self.df
  • Also transforms now make the inlace transformation

The necessary columns are defined using the in_column attribute, added in #810

Test cases

  1. Test that update_dataset works correctly in different cases(update_regressors + update columns)
  2. Test fit, transform, inverse_transform logic using mocks

Additional context

Is blocked by #810

@alex-hse-repository alex-hse-repository added the enhancement New feature or request label Jul 14, 2022
@alex-hse-repository alex-hse-repository added this to the TSDataset 2.0 milestone Jul 14, 2022
@alex-hse-repository alex-hse-repository moved this to Specification in etna board Jul 14, 2022
@alex-hse-repository alex-hse-repository changed the title Make base class of Transforms work with TSDataset [DRAFT]Make base class of Transforms work with TSDataset Jul 14, 2022
@alex-hse-repository alex-hse-repository moved this from Specification to Todo in etna board Jul 22, 2022
@alex-hse-repository alex-hse-repository moved this from Todo to Hold in etna board Jul 22, 2022
@alex-hse-repository
Copy link
Collaborator Author

Special in_column handling in ResamplingTransform

@alex-hse-repository alex-hse-repository moved this from Hold to Todo in etna board Jul 29, 2022
@alex-hse-repository alex-hse-repository self-assigned this Jul 29, 2022
@alex-hse-repository alex-hse-repository moved this from Todo to In Progress in etna board Jul 29, 2022
@alex-hse-repository alex-hse-repository moved this from In Progress to Hold in etna board Aug 3, 2022
@alex-hse-repository alex-hse-repository moved this from Hold to In Progress in etna board Aug 4, 2022
@martins0n martins0n moved this from In Progress to In Review in etna board Aug 4, 2022
@alex-hse-repository alex-hse-repository linked a pull request Aug 17, 2022 that will close this issue
4 tasks
@alex-hse-repository alex-hse-repository moved this from In Review to Done in etna board Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant