[Python] Why Prophet returns negative prediction whan inputs are all positive?

Discussão em 'Python' iniciado por Stack, Fevereiro 1, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to forecast with Facebook Prophet, the input are all positive but the predictions returns negative. I'm kind of confused, i read this quick start and if the inputs are all positive then the predictions will be likely all positive and the shape of the prediction is similar like the input e.g if input is 0.86 then the output would be 0.81. Why is it like this? How to fix it?

    covid_pr = covid[['date','acc_confirmed']].copy()
    covid_pr.rename(columns = {'date':'ds', 'acc_confirmed':'y'},inplace= True)

    prt = Prophet()
    prt.fit(covid_pr)

    future_prt = prt.make_future_dataframe(30)
    forecast = prt.predict(future_prt)


    My input data

    ds y
    0 2020-03-02 2
    1 2020-03-03 2
    2 2020-03-04 2
    3 2020-03-05 2
    4 2020-03-06 4
    5 2020-03-07 4
    6 2020-03-08 6
    7 2020-03-09 19
    8 2020-03-10 27
    9 2020-03-11 34
    10 2020-03-12 34
    etc until thousands


    Prediction of fbprophet

    yhat yhat_lower yhat_upper
    0 -261.572541 -499.409024 -4.741004
    1 -208.490561 -446.503629 41.371788
    2 -255.114682 -500.580393 -7.825269
    3 -208.963597 -481.238870 33.707433
    4 -146.566250 -394.337188 96.726382
    5 -92.445918 -354.914790 150.409867
    6 -38.341696 -293.639411 204.964963
    7 83.483534 -158.412231 332.263619
    8 136.565514 -95.174934 370.980615
    9 89.941393 -153.219255 349.129866
    10 136.097121 -95.508485 404.666524
    etc until thousands

    Continue reading...

Compartilhe esta Página