sky-uk/anticipy

Error in model_utils.get_s_x_extrapolate() - input with gaps at the beginning

capelastegui opened this issue · 2 comments

There is a bug related to model_naive, introduced in v0.2.0

  File "/virtual3.8/lib/python3.8/site-packages/anticipy/forecast.py", line 928, in run_forecast
    return run_forecast_single(df_y,
  File "/python3.8/site-packages/anticipy/forecast.py", line 1370, in run_forecast_single
    df_data_tmp = extrapolate_model(
  File "/virtual3.8/lib/python3.8/site-packages/anticipy/forecast.py", line 720, in extrapolate_model
    s_y_forecast = pd.Series(data=a_y_forecast, index=s_x.index, name='y')
  File "/virtual3.8/lib/python3.8/site-packages/pandas/core/series.py", line 313, in __init__
    raise ValueError(
ValueError: Length of passed values is 522, index implies 261.

It looks similar to #199

Problem is related to:

  • model_naive()
  • where df_actuals has samples with weight 0, at the beginning.

I think model_utils.get_normalized_x_from_date() has problems with null values

In run_forecast_single(), we pass df_actuals_interpolated rather than df_actuals to fit_model() and extrapolate_model(). We may be missing interactions between the interpolation logic and 0-weight samples in our unit tests

Fixed on the dev branch, need to prepare a bugfix release