Slackbot
12/11/2023, 2:48 PMJosé Morales
12/11/2023, 5:07 PMfrom utilsforecast.preprocessing import fill_gaps
filled = fill_gaps(HCPCS_Grouped_ts_mlf, start='per_serie', end='per_serie', freq='MS')
assert filled.shape[0] == HCPCS_Grouped_ts_mlf.shape[0]
If this fails it means some dates are missing and you could provide the filled
df instead (after filling the target missing values)Brian Head
12/11/2023, 5:55 PMts2 = fill_gaps(ts2, freq='MS')
in a previous step. Went ahead and ran the code above and it ran successfully. I didn't have the start and stop in mine, but tested and I get the same shape either way.José Morales
12/11/2023, 5:56 PMBrian Head
12/11/2023, 5:57 PMName: neuralforecast
Version: 1.6.4
Summary: Time series forecasting suite using deep learning models
Home-page: <https://github.com/Nixtla/neuralforecast/>
Author: Nixtla
Author-email: <mailto:business@nixtla.io|business@nixtla.io>
License: Apache Software License 2.0
Location: c:\programdata\miniconda3\envs\py310env\lib\site-packages
Requires: numba, numpy, optuna, pandas, pytorch-lightning, ray, torch, utilsforecast
Required-by:
Note: you may need to restart the kernel to use updated packages.
Brian Head
12/11/2023, 5:57 PMJosé Morales
12/11/2023, 6:00 PMBrian Head
12/11/2023, 6:01 PMBrian Head
12/11/2023, 6:01 PMBrian Head
12/11/2023, 6:02 PMJosé Morales
12/11/2023, 6:05 PMBrian Head
12/11/2023, 6:11 PMforecasts_nf_df_fits = nf.predict_insample(step_size=1)
of my code.José Morales
12/11/2023, 6:12 PMBrian Head
12/11/2023, 6:19 PMValueError Traceback (most recent call last)
Cell In[182], line 1
----> 1 forecasts_nf_df_fits = nf.predict_insample(step_size=1)
File C:\ProgramData\miniconda3\envs\py310env\lib\site-packages\neuralforecast\core.py:622, in NeuralForecast.predict_insample(self, step_size)
620 # Append predictions in memory placeholder
621 output_length = len(model.loss.output_names)
--> 622 fcsts[:, col_idx : (col_idx + output_length)] = model_fcsts
623 col_idx += output_length
624 model.set_test_size(test_size=test_size) # Set original test_size
ValueError: could not broadcast input array from shape (159510,9) into shape (158616,9)
Brian Head
12/11/2023, 6:19 PMJosé Morales
12/11/2023, 6:20 PMJosé Morales
12/11/2023, 6:21 PMBrian Head
12/11/2023, 6:23 PMJosé Morales
12/11/2023, 6:27 PMJosé Morales
12/11/2023, 6:27 PMBrian Head
12/11/2023, 6:32 PMCristian (Nixtla)
12/11/2023, 7:57 PMBrian Head
12/11/2023, 8:03 PMfilled = fill_gaps(HCPCS_Grouped_ts_mlf, start='per_serie', end='per_serie', freq='MS')
which returns the different DF shape. I was following this. Now I'm wondering if the first part of what you sent (including the start and end for the fill_gaps function) was only for testing that or if I should use (e.g., which should I use)? I still get the error either way, but want to make sure I'm using getting the right gaps filled. BTW, I also checked and it is filling gaps with both approaches, but more with the version you provided.José Morales
12/11/2023, 8:45 PMBrian Head
12/11/2023, 8:51 PMfill_gaps
by using a .fillna after.José Morales
12/11/2023, 8:56 PMend='global'
José Morales
12/11/2023, 9:17 PMpip install git+<https://github.com/nixtla/neuralforecast.git|https://github.com/nixtla/neuralforecast.git>
José Morales
12/11/2023, 9:20 PMBrian Head
12/12/2023, 2:45 PMfill_gaps
function prior to model fit and predictions. In a previous run (using similar data on a slightly older version of Nixtla packages) I used the default setting with fill_gaps
not realizing there were options for the start and end dates of filling. That worked correctly. However, it wasn't working now, so I played with the options for start and end. The only way any of the models I've tried (e.g., NBEATS, NBEATSx, RNN, DilatedRNN, NHITS, LSTM, MLP) will successfully run the predict_insample
is when I set both start
and end
to global
. However, this produces odd results for some of the series that have a later start date--at the beginning of the series they have a major spike in the insample predictions when nothing actually occured there. Is there any workaround for this?
Note: Here are the current versions of packages I'm using
• Neuralforecast 1.6.4
• Statsforecast 1.6.0 - for deriving season and trend
• Utilsforecast 0.0.21José Morales
12/12/2023, 3:58 PMJosé Morales
12/12/2023, 4:12 PMBrian Head
12/12/2023, 4:13 PM