Reputation: 69
I'm running this code. Forecasting for multiple time series with Prophet but don't know how to evaluate the model.
import pandas as pd
from fbprophet import Prophet
data = pd.read_csv(r'C:\Users\XXX.csv')
ids = data['id'].unique()
series = []
for id in ids:
f = data[data['id'] == id]
series.append(f)
def run_prophet(timeserie):
model = Prophet(yearly_seasonality=False,daily_seasonality=False)
model.fit(timeserie)
forecast = model.make_future_dataframe(periods=90, include_history=False)
forecast = model.predict(forecast)
return forecast
results = list(map(lambda timeserie: run_prophet(timeserie), series))
results[0]
results[1]
The structure of the data is something like this:
id ds y
id1 2017-01-01 12
id2 2017-01-01 15
id3 2017-01-01 16
Upvotes: 1
Views: 3349
Reputation: 92
you can do it by:
from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error
r2_score(original price,predicted price)
this is same for the rest.
note: both arrays should have equal length of samples.
Upvotes: 1