Skip to content

Add forecast components handling in TSDataset #1142

Closed
alex-hse-repository opened this issue Mar 1, 2023 · 0 comments · Fixed by #1153
Closed

Add forecast components handling in TSDataset #1142

alex-hse-repository opened this issue Mar 1, 2023 · 0 comments · Fixed by #1153
Assignees
Labels
enhancement New feature or request

Comments

@alex-hse-repository
Copy link
Collaborator

alex-hse-repository commented Mar 1, 2023

🚀 Feature Request

Meta-data about forecast components should be stored in the TSDataset and updated via it's interface.

Proposal

  1. In the constructor add attribute:
self._target_components: Optional[List[str]] = None
  1. Add property:
def target_components(self) -> Optional[List[str]]
  1. Create method
def add_target_components(self, df: pd.DataFrame)
  • df -- dataframe in wide format with the forecast/predict components
  • check that self._target_components is not initialized yet, in the other case throw error
  • check that each segment contains the same set of components
  • check that components in each segment sum up to target in the dataset
  • store component names in self._target_components
  • merge df with self.df
  1. Create method
def get_target_components(self) -> Optional[pd.DataFrame]
  • if self._target_componets is not initialized return None
  • Return dataframe with self._target_componets if exists
  1. In methods tsdataset_idx_slice, train_test_split, get_level_dataset copy self._target_components to the new datasets
  2. In the end of make_future reset self._target_components to None
  3. In drop_features throw error if user tries to drop some of the components and don't drop them

Test cases

  1. Test that get_target_components works correctly
  • Return None if self._target_components not initialized
  • Return dataframe with correct columns in the other case
  1. Test that add_target_components
  • Raise error in case of inconsistent set of components, initialized self._target_components, components don't sum up to target
  • Store component names in self.target_components
  • Store components in self.df
  1. Check that components are copied to the new datasets in tsdataset_idx_slice, train_test_split, get_level_dataset
  2. Check that make_furture reset self._target_components attribute
  3. Check that drop_features throw error in case of trying to drop the components

Additional context

There should be only one set of components. We add it via add_target_components and can't modify this set anymore. If components present in the dataset, they are consistent with target.

@alex-hse-repository alex-hse-repository added the enhancement New feature or request label Mar 1, 2023
@github-project-automation github-project-automation bot moved this to Specification in etna board Mar 1, 2023
@alex-hse-repository alex-hse-repository moved this from Specification to Todo in etna board Mar 2, 2023
@alex-hse-repository alex-hse-repository self-assigned this Mar 3, 2023
@alex-hse-repository alex-hse-repository moved this from Todo to In Progress in etna board Mar 3, 2023
@alex-hse-repository alex-hse-repository moved this from In Progress to In Review in etna board Mar 6, 2023
@github-project-automation github-project-automation bot moved this from In Review to Done in etna board Mar 7, 2023
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