model_list <- prophet(WHO_data_list, growth = "logistic", changepoints = None, n_changepoints = 25, changepoint_range = 0.8, yearly_seasonality = T, weekly_seasonality = F, daily_seasonality = F, holidays= None, seasonality_mode = 'multiplicative', seasonality_prior_scale = 10.0, holidays_prior_scale = 10.0, changepoint_prior_scale = 0.05, mcmc_samples = 0, interval_width = 0.95, uncertainty_samples = 1000, stan_backend = None)
时间: 2024-02-10 09:19:14 浏览: 117
这是一个使用 Prophet 模型对 WHO_data_list 进行时间序列预测的代码。在该模型中,使用了逻辑增长模型(growth = "logistic"),没有设置特殊的变化点(changepoints = None),设置了25个变化点(n_changepoints = 25),变化点范围为80%(changepoint_range = 0.8),启用了年度季节性(yearly_seasonality = T),未启用周季节性和日季节性(weekly_seasonality = F, daily_seasonality = F),没有添加节假日信息(holidays= None),季节性模式为乘法模式(seasonality_mode = 'multiplicative'),季节性先验比例为10.0(seasonality_prior_scale = 10.0),节假日先验比例为10.0(holidays_prior_scale = 10.0),变化点先验比例为0.05(changepoint_prior_scale = 0.05),采样次数为0(mcmc_samples = 0),置信区间为95%(interval_width = 0.95),不确定性采样次数为1000(uncertainty_samples = 1000),后端使用默认值(stan_backend = None)。
相关问题
prophet_model.plot(prophet_predict_df, ax=ax,include_legend=True)
I'm sorry, as an AI language model, I cannot run this code snippet as it requires the complete code and data to be available. However, I can explain the possible functionality of this code snippet.
Based on the given code snippet, it seems that the Prophet model has been trained and the predictions have been stored in the `prophet_predict_df` dataframe. The `plot` function of the Prophet model is then called to plot the predicted values on the matplotlib axis `ax`. The `include_legend` parameter is set to `True` to display the legend on the plot. The plot may show the actual and predicted values of a time series and any trends, seasonality, or other patterns in the data.
> future <- make_future_dataframe(m,periods=1) Error in make_future_dataframe(m, periods = 1) : Model must be fit before this can be used.
这个错误是因为在使用 `make_future_dataframe()` 函数之前,需要先对时间序列模型进行拟合(fit)。
在使用 `prophet` 包建立时间序列模型时,需要先使用 `prophet()` 函数创建一个 `Prophet` 对象,然后使用 `fit()` 函数对数据进行拟合。在拟合完成后,就可以使用 `make_future_dataframe()` 函数生成新的时间戳数据。
以下是一个简单的例子:
```r
library(prophet)
# 创建时间序列模型
m <- prophet(my_data)
# 拟合数据
m <- fit(m, my_data)
# 生成未来时间戳数据
future <- make_future_dataframe(m, periods = 1)
```
在这个例子中,我们首先使用 `prophet()` 函数创建一个 `Prophet` 对象 `m`,然后使用 `fit()` 函数对数据进行拟合。最后,我们使用 `make_future_dataframe()` 函数生成一个包含一个未来时间戳的数据框 `future`。
确保在使用 `make_future_dataframe()` 函数之前,先对时间序列模型进行拟合,就可以避免这个错误。
阅读全文