0

I am looping over a big data set of time series sorted by ids and noticed something very strange: When my data is a flat 1 I get a prediction of zeros and not a flat 1

  1. Why does this happen?
  2. Is there a parameter i can use to prevent this?
model = AutoARIMA()
print("data:\n", ratio_df[['date',  'UD20']])
model.fit(ratio_df[['date', 'UD20']].set_index('date')['UD20'])
print("prediction:\n",model.predict(20))

Output loks like:

data:
           date  UD20
 2021-07-31   1.0
 2021-08-31   1.0
 2021-09-30   1.0
 2021-10-31   1.0
 2021-11-30   1.0
 2021-12-31   1.0
 2022-01-31   1.0
 2022-02-28   1.0
 2022-05-31   1.0
 2022-06-30   1.0
 2022-07-31   1.0
 2022-08-31   1.0
 2022-09-30   1.0
 2022-10-31   1.0
 2022-11-30   1.0
 2022-12-31   1.0
 2023-01-31   1.0
 2023-02-28   1.0
   
prediction:  
    0.0
    0.0
    0.0
    0.0
    0.0
    0.0
    0.0
    0.0
    0.0
    0.0

When i added a little noise fit was fixed:

model = AutoARIMA()
ratio_df['noiseUD20'] = ratio_df['UD20']+ np.random.normal(0,0.022,18)
model.fit(ratio_df[['date', 'noiseUD20']].set_index('date')['noiseUD20'])

print("data:\n", ratio_df[['date',  'noiseUD20']])
model.fit(ratio_df[['date', 'noiseUD20']].set_index('date')['noiseUD20'])
print("prediction:\n",model.predict(10)) 

output look like so:

data:
           date  noiseUD20
 2021-07-31   1.019080
 2021-08-31   0.944251
 2021-09-30   0.991952
 2021-10-31   0.995023
 2021-11-30   1.013006
 2021-12-31   1.002536
 2022-01-31   1.010659
 2022-02-28   1.023755
 2022-05-31   0.984124
 2022-06-30   1.012452
 2022-07-31   0.966113
 2022-08-31   1.019860
 2022-09-30   0.966985
 2022-10-31   1.015021
 2022-11-30   0.968831
 2022-12-31   0.942786
 2023-01-31   1.007814
 2023-02-28   1.018689

prediction:
    0.994608
    0.994608
    0.994608
    0.994608
    0.994608
    0.994608
    0.994608
    0.994608
    0.994608
    0.994608
    
eliavs
  • 2,306
  • 4
  • 23
  • 33

0 Answers0