https://github.com/nixtla logo
m

Matej

08/15/2023, 4:01 PM
Hi MLforecast/Nixtla team, great great work with all the Nixtla python packages, thanks in advance for your patience with my question. • I found a really good tutorial for MLforecasts including target transforms that are nicely done in a plug and play manner. https://github.com/Nixtla/mlforecast/blob/main/nbs/docs/end_to_end_walkthrough.ipynb I found the following interface:
Copy code
class BaseTargetTransform(abc.ABC):
    def set_column_names(self, id_col: str, time_col: str, target_col: str):
        self.id_col = id_col
        self.time_col = time_col
        self.target_col = target_col
        
    @abc.abstractmethod
    def fit_transform(self, df: 'pd.DataFrame') -> 'pd.DataFrame':
        raise NotImplementedError
        
    @abc.abstractmethod
    def inverse_transform(self, df: 'pd.DataFrame') -> 'pd.DataFrame':
        raise NotImplementedError
Q: How would I go about coding my own MSTL decomposition target transform ?
I am asking because MSTL is part of statsforecast library already so I wonder if there is something built in. Thanks :)
j

José Morales

08/15/2023, 4:23 PM
Hey, thanks for the kind words. There's no built-in way at the moment but we've thought of supporting target transforms that take statsforecast models. Would your use case involve fitting the MSTL, subtracting its prediction from the current target and passing that to mlforecast?
m

Matej

08/16/2023, 8:18 AM
yes something along those lines or perhaps have MSTL in the tsfeatures to generate seasonal component that can then be used as lagged feature, etc.