Nixtla/hierarchicalforecast

TopDown Approach doesn't raise Exception as expected with `method="forecast_proportions"`

baniasbaabe opened this issue · 0 comments

What happened + What you expected to happen

Calling

hrec = HierarchicalReconciliation(reconcilers=[TopDown(method="forecast_proportions")])

surprisingly works, since in hierarchicalforecast/hierarchicalforecast/methods.py, the following lines in the TopDown class appears

elif self.method == 'forecast_proportions':
      raise Exception(f'Fit method not implemented for {self.method} yet')

So forecast_proportions shouldn't work, right?

Versions / Dependencies

0.3.0

Reproduction script

It's the snippet from the README of this project:

# !pip install -U numba statsforecast datasetsforecast
import pandas as pd

# compute base forecast no coherent
from statsforecast.core import StatsForecast
from statsforecast.models import AutoARIMA, Naive

#obtain hierarchical reconciliation methods and evaluation
from hierarchicalforecast.core import HierarchicalReconciliation
from hierarchicalforecast.methods import BottomUp, TopDown, MiddleOut

#obtain hierarchical datasets
from datasetsforecast.hierarchical import HierarchicalData

# Load TourismSmall dataset
Y_df, S, tags = HierarchicalData.load('./data', 'TourismSmall')
Y_df['ds'] = pd.to_datetime(Y_df['ds'])


# Compute base level predictions 
sf = StatsForecast(df=Y_df, 
                   models=[AutoARIMA(season_length=12), Naive()], 
                   freq='M', n_jobs=-1)

forecasts_df = sf.forecast(h=12)

# Reconcile the base predictions
reconcilers = [
    TopDown(method='forecast_proportions'),
]

hrec = HierarchicalReconciliation(reconcilers=reconcilers)

reconciled_forecasts = hrec.reconcile(Y_hat_df=forecasts_df, S=S, tags=tags)

Issue Severity

Low: It annoys or frustrates me.