zhang qiao
Upload folder using huggingface_hub
9ddee9f
raw
history blame
487 Bytes
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:]