本文整理汇总了Python中fbprophet.Prophet.plot方法的典型用法代码示例。如果您正苦于以下问题:Python Prophet.plot方法的具体用法?Python Prophet.plot怎么用?Python Prophet.plot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fbprophet.Prophet
的用法示例。
在下文中一共展示了Prophet.plot方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from fbprophet import Prophet [as 别名]
# 或者: from fbprophet.Prophet import plot [as 别名]
def run():
journal = ledger.read_journal("./secret/ledger.dat")
last_post = None
amount = 0
for post in journal.query(""):
if last_post == None or post.date == last_post.date:
if str(post.amount.commodity) != "£":
continue
amount = amount + post.amount
else:
print post.date, ",", amount
amount = 0
last_post = post
df = pd.read_csv('./testing.csv')
df['y'] = np.multiply(100, df['y'])
m = Prophet()
m.fit(df);
forecast = m.predict(future)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
m.plot(forecast);
m.plot_components(forecast);
示例2: forecasts
# 需要导入模块: from fbprophet import Prophet [as 别名]
# 或者: from fbprophet.Prophet import plot [as 别名]
#print(forecast1[['ds','yhat','yhat_lower','yhat_upper']])
#%%
## This works and retained the dataframe type
forecast2 = np.exp(forecast1[['yhat','yhat_lower','yhat_upper']])
## Now merge to bring the ds back into the df
## Without the "on" keyword the join key is implicitly the index which is what we're doing here
forecast2 = forecast2.join(forecast1['ds'], how='inner')
#%%
## This works
## This will create a plot that includes Forecasted, C.I.'s, and Actual values
m.plot(forecast1)
#%%
## I think it is unecessary to review exponentiated components
## Plus the complexity of joining forecast2 with forecast1
m.plot_components(forecast1);
#%%
## It was necessary, in the fill_between, to use a datetime index associated with
## the first parameter of the function.
## This necessitated converting the existing ds datetime element to an index
pplt.subplots(figsize=(30,10))
forecast2.set_index('ds',inplace=True)
## If using the view_hour data it will be REQUIRED to exponentiate the forecasts (i.e., forecast2)
pplt.plot(view_hour['distinct_freq_sum'], label='Original', color='black');
示例3: Prophet
# 需要导入模块: from fbprophet import Prophet [as 别名]
# 或者: from fbprophet.Prophet import plot [as 别名]
import pandas as pd
import numpy as np
from fbprophet import Prophet
# Prep the dataset
data = pd.read_csv("/home/dusty/Econ8310/DataSets/chicagoBusRiders.csv")
route3 = data[data.route=='3'][['date','rides']]
route3.date = pd.to_datetime(route3.date, infer_datetime_format=True)
route3.columns = [['ds', 'y']]
# Initialize Prophet instance and fit to data
m = Prophet()
m.fit(route3)
# Create timeline for 1 year in future, then generate predictions based on that timeline
future = m.make_future_dataframe(periods=365)
forecast = m.predict(future)
# Create plots of forecast and truth, as well as component breakdowns of the trends
plt = m.plot(forecast)
plt.show()
comp = m.plot_components(forecast)
comp.show()
示例4: print
# 需要导入模块: from fbprophet import Prophet [as 别名]
# 或者: from fbprophet.Prophet import plot [as 别名]
print(forecast['yhat_upper'][0:5])
#%%
## This works and retained the dataframe type
forecast2 = np.exp(forecast1[['yhat','yhat_lower','yhat_upper']])
## Now merge to bring the ds back into the df
## Without the "on" keyword the join key is implicitly the index
forecast2 = forecast2.join(forecast1['ds'], how='inner')
print(forecast1)
#%%
## This works
## This will create a plot that includes Forecasted, C.I.'s, and Actual values
m.plot(forecast2)
#%%
## I think it is unecessary to review exponentiated components
## Plus the complexity of joining forecast2 with forecast1
m.plot_components(forecast1);
#%%
## It was necessary, in the fill_between, to use a datetime index associated with
## the first parameter of the function.
## This necessitated converting the existing ds datetime element to an index
pplt.subplots(figsize=(30,10))
forecast2.set_index('ds',inplace=True)
pplt.plot(view_hour['distinct_freq_sum'], label='Original', color='black');
pplt.plot(forecast2.yhat, color='red', label='Forecast');
示例5:
# 需要导入模块: from fbprophet import Prophet [as 别名]
# 或者: from fbprophet.Prophet import plot [as 别名]
#print(forecast1[['ds','yhat','yhat_lower','yhat_upper']])
#%%
## This works and retained the dataframe type
forecast2 = np.exp(forecast1[['yhat','yhat_lower','yhat_upper']])
## Now merge to bring the ds back into the df
## Without the "on" keyword the join key is implicitly the index which is what we're doing here
forecast2 = forecast2.join(forecast1['ds'], how='inner')
#%%
## This works
## This will create a plot that includes Forecasted, C.I.'s, and Actual values
m.plot(forecast)
#%%
## Save a copy of the plot
fig = m.plot(forecast)
fig.savefig("/home/steve/forecast_raw.jpeg")
#%%
## I think it is unecessary to review exponentiated components
## Plus the complexity of joining forecast2 with forecast1
m.plot_components(forecast1);
#%%
## It was necessary, in the fill_between, to use a datetime index associated with
## the first parameter of the function.
## This necessitated converting the existing ds datetime element to an index