https://github.com/nixtla logo
#general
Title
# general
n

Naren Castellon

06/28/2023, 5:09 AM
Hello Nixtla team.
Copy code
I am making a Machine Learning model, but it turns out that I have the following problem when I make the predictions with the predict method by adding the level(confidence interval) parameter, it gives me an error, 
                                                                                           mlf.fit(df1, id_col='unique_id', time_col='ds', target_col='y',prediction_intervals=PredictionIntervals(n_windows=5, window_size=18))
k

Kevin Kho

06/28/2023, 5:23 AM
Are you trying to do something like this?
Copy code
from statsforecast.core import StatsForecast
from statsforecast.models import ( 
    AutoARIMA,
    AutoETS,
)
from statsforecast.utils import generate_series, ConformalIntervals

series = generate_series(5)

sf = StatsForecast(
    models=[AutoETS(season_length=7)],
    freq='D',
)
# sf.forecast(df=series, h=horizon).head()
sf.fit(series, prediction_intervals=ConformalIntervals(n_windows=2, h=10))
sf.predict(18, level=[20,30])
n

Naren Castellon

06/28/2023, 9:35 AM
Hi @Kevin Kho Something like this but with Mlforecast, with statsforecast there is no problem
k

Kevin Kho

06/28/2023, 4:02 PM
Ah gotcha, I am less familiar with MLForecast
m

Max (Nixtla)

06/29/2023, 3:54 PM
@José Morales: could you try to help Naren?
j

José Morales

06/29/2023, 3:55 PM
I've answered the issue, I think it's more beneficial to have this conversation there
m

Max (Nixtla)

06/29/2023, 3:57 PM
Thanks! I wasn’t aware of that.
m

marah othman

07/03/2023, 11:51 PM
https://nixtlacommunity.slack.com/archives/C031M8RLC66/p1688397461750749 @José Morales i think i have error in same reshape function could you give me your opinion?
j

José Morales

07/04/2023, 12:41 AM
I think this can happen if there's a gap in your series, e.g. a missing day
m

marah othman

07/04/2023, 7:55 AM
i thought that also but i am not sure so can i choose the window size to be not this happend do you have idea?
j

José Morales

07/04/2023, 8:04 PM
Do you have a single serie?
m

marah othman

07/05/2023, 9:34 AM
yes i have single @José Morales
for know is there different if i have multiple ?
j

José Morales

07/05/2023, 4:30 PM
No, I just think it may be easier to debug. Can you try the following: df['ds'].sort_values().diff().value_counts() to see if there's a gap?
m

marah othman

07/05/2023, 6:10 PM
0 days 010000 4703 73 days 210000 1 1 days 040000 1 0 days 020000 1 0 days 060000 1 2 days 150000 1 here the output
@José Morales
j

José Morales

07/05/2023, 6:24 PM
Your series need to have a regular frequency, seems like you have mostly 1 hr differences but some observations are very far apart. If you don't care about the dates you can just use an incremental integer as the time column
m

marah othman

07/05/2023, 6:26 PM
what do you mean what do you mean by regular frequency i have data every 1 hour but in january for example doesnt have data
how can i dont care about the date if i am usring the lags and every properites for time series
maybe i need to fill the gap?
the gap is the missing value right?
j

José Morales

07/05/2023, 6:33 PM
Yes, you need to fill the gap so that the diff command above returns a single value
m

marah othman

07/05/2023, 6:34 PM
you mean return 0 instead of 73 for example?
j

José Morales

07/05/2023, 6:47 PM
Yes, all of your samples should be one hour apart. If you don't have data for that period you need to fill it with 0s, interpolate or similar
m

marah othman

07/05/2023, 6:48 PM
but if i dont have data for one month this a big priode right ?
i was thinking by predict this priode and then merge it again
j

José Morales

07/05/2023, 7:03 PM
That would work as well