Skip to content

Enhance TSDataset to work with hierarchical series #1028

Closed
alex-hse-repository opened this issue Dec 6, 2022 · 0 comments
Closed

Enhance TSDataset to work with hierarchical series #1028

alex-hse-repository opened this issue Dec 6, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@alex-hse-repository
Copy link
Collaborator

alex-hse-repository commented Dec 6, 2022

🚀 Feature Request

Enhance TSDataset to handle the dataset with hierarchical structure

Proposal

  1. Edit the constructor of TSDataset
    def __init__(
            self,
            ....,
            hierarchical_structure: Optional[HierarchicalStructure] = None
    ) -> TSDataset:
        """
        df_exog:
            Dataframe with exogenous data; If hierarchy is passed should be the dataframe of the target level, which will be forecasted
        hierarchical_structure:
            Structure of the levels in the hierarchy. If None, there is no hierarchical structure in the dataset.
        """
  • Add attribute current_level: str -- get it from the structure, it can be obtained by the segments in df
  • In the constructor and make_future method merge exog into target only if they are on the same hierarchical level, in the other case do't merge it. If there is no hierarchy in the dataset this methods should fail in case of inconsistency between df and df_exog
  1. Add some helper functions:
    @property
    def level_names(self) -> List[str]:
        pass
    def get_level_segments(self, level_name: str) -> List[str]
        pass
  • Get this info from the hierarchy

Test cases

  1. Test constructor works correctly on sample data, dataset should contain the correct df, current_level or not be created
  • df contains segments not consistent with hierarchy
  • df_exog contains segments not consistent with hierarchy
  • df, df_exog consistent with hierarchy and on the same level
  • df, df_exog consistent with hierarchy and on different levels same level
  1. Test make_future works correctly in case of hierarchical/non-hierarchical data:
  • df, df_exog consistent with hierarchy and on the same level
  • df, df_exog consistent with hierarchy and on different levels

Additional context

No response

@alex-hse-repository alex-hse-repository added the enhancement New feature or request label Dec 6, 2022
@alex-hse-repository alex-hse-repository changed the title Create HTSDataset Enhance TSDataset to work with hierarchical series Dec 7, 2022
@alex-hse-repository alex-hse-repository self-assigned this Dec 14, 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

No branches or pull requests

1 participant