File size: 487 Bytes
9ddee9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import pandas as pd
from prophet import Prophet
import numpy as np


class ProphetWrapper():
    def __init__(self):
        pass

    def forecast(self, ts, n_predict, freq=None):
        model = Prophet()
        train = ts.rename(columns={'datetime': 'ds'})

        model.fit(train)

        future = model.make_future_dataframe(periods=n_predict, freq=freq)

        forecasted = model.predict(future)

        print(forecasted[-n_predict:])

        return forecasted[-n_predict:]