i get this when i want to update my model. i only ...
# mlforecast
j
i get this when i want to update my model. i only want to update 45 from 47 articles and the rest is not included in my update_df. i thought this worked before (and i think i did partial updating before), but can't figure out what is the problem here. any ideas? --->
45 loaded_model.update(df_update)
46
*47* # apply encoder:
~/miniconda3/envs/demand_env/lib/python3.8/site-packages/mlforecast/forecast.py in update(self, df)
*986*         df : pandas or polars DataFrame
*987*             Dataframe with new observations."""
--> 988         self.ts.update(df)
~/miniconda3/envs/demand_env/lib/python3.8/site-packages/mlforecast/core.py in update(self, df)
*867*                 if isinstance(tfm, _BaseGroupedArrayTargetTransform):
*868*                     ga = GroupedArray(values, indptr)
--> 869                     ga = tfm.update(ga)
*870*                     df = ufp.assign_columns(df, self.target_col, ga.data)
*871*                 else:
~/miniconda3/envs/demand_env/lib/python3.8/site-packages/mlforecast/target_transforms.py in update(self, ga)
*111*         core_ga = CoreGroupedArray(ga.data, ga.indptr, self.num_threads)
*112*         for scaler in self.scalers_:
--> 113             transformed = scaler.update(core_ga)
*114*             core_ga = core_ga._with_data(transformed)
*115*         return GroupedArray(transformed, ga.indptr)
~/miniconda3/envs/demand_env/lib/python3.8/site-packages/coreforecast/scalers.py in update(self, ga)
*348*         )
*349*         if self.tails_.size != tails_indptr[-1]:
--> 350             raise ValueError("Number of tails doesn't match the number of groups")
*351*         tails_ga = GroupedArray(self.tails_, tails_indptr, num_threads=ga.num_threads)
*352*         combined = tails_ga._append(ga)
ValueError: Number of tails doesn't match the number of groups
for those of you interested in that question: so it seems you really have to update on all articles that you trained on when you add more (or future) dates. at least this is how i solved it now. if i add one more week of historic data to my ids, but i dont cover 100% of the ids in that updating (let's say some articles have gone offline in the meantime or so), then i just fill all values for the missing ids with zeros. then updating works and in the next step i only return forecasts for my subset of articles that are still relevant for me. this is how i solved it, happy to hear other solutions also.
j
This is a current limitation of the target transformations. If you don't have any then you can update a subset of the series, but with target transformations we currently require updating all of them
j
ah, ok. this makes sense now as i probably sometimes had a target transformation and sometimes not and was surprised that it worked before on the same data, but then did not work again. and the reason is the possible target transformation due to tuning. perfect! thx a lot (again)!