Prophet algorithm framework prediction output and usage method

Prophet Time Series Forecast Framework Introductory Practice Notes
Continuing from the above, forecast results:

forecast = m.predict(future)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail(48)

forecast is a DataFrame of Pandas, and the data items and their meanings are as follows:

  • 'ds': is a datetime stamp column, representing each time point in the time series.
  • 'trend': is a trend item, which represents the model prediction value of the overall trend.
  • 'trend_lower': is the lower bound of the trend item, indicating the lowest possible value of the trend item.
  • 'trend_upper': is the upper limit of the trend item, indicating the highest possible value of the trend item.
  • 'Lunar_festivals': This is a customized lunar festival item based on the actual situation, indicating the impact of lunar festivals on the forecast results.
  • 'Lunar_festivals_lower': is the lower bound of the Lunar festivals item, indicating the lowest possible value of the Lunar festivals item.
  • 'Lunar_festivals_upper': is the upper limit of the Lunar festivals item, indicating the highest possible value of the Lunar festivals item.
  • 'additive_terms': is the additive component, including the sum of seasonal terms and holiday terms.
  • 'additive_terms_lower': is the lower bound of the additive terms, representing the lowest possible value of the additive terms.
  • 'additive_terms_upper': is the upper bound of the additive terms, representing the highest possible value of the additive terms.
  • 'china': This is a Chinese holiday item customized according to the actual situation, indicating the impact of Chinese holidays on the forecast results.
  • 'china_lower': is the lower bound of the Chinese holiday term, indicating the lowest possible value of the Chinese holiday term.
  • 'china_upper': is the upper bound of the Chinese holiday item, indicating the highest possible value of the Chinese holiday item.
  • 'daily': is a daily seasonal item, indicating the impact of daily seasonality on the forecast results.
  • 'daily_lower': is the lower bound of the daily seasonal term, representing the lowest possible value of the daily seasonal term.
  • 'daily_upper': is the upper bound of the daily seasonal item, representing the highest possible value of the daily seasonal item.
  • 'holidays': is the sum of all holiday items, including lunar festivals and Chinese holidays.
  • 'holidays_lower': is the lower bound of all holiday items, representing the lowest possible value of all holiday items.
  • 'holidays_upper': is the upper bound of all holiday items, representing the highest possible value of all holiday items.
  • 'weekly': is a weekly seasonal item, indicating the impact of weekly seasonality on the forecast results.
  • 'weekly_lower': is the lower bound of the weekly seasonal term, representing the lowest possible value of the weekly seasonal term.
  • 'weekly_upper': is the upper limit for weekly seasonal items, meaning weekly
  • 'multiplicative_terms', 'multiplicative_terms_lower', 'multiplicative_terms_upper': These columns represent the multiplicative terms (Multiplicative Terms) in the Prophet model. In the modeling process of time series, the Prophet model can use additive model (Additive Model) or multiplicative model (Multiplicative Model) to represent the relationship between trend and seasonality. These columns provide estimates of the multiplicative term, with corresponding lower and upper bounds.
  • 'yhat': Indicates the prediction result of the model for future values. It is an estimate of future trends and seasonality calculated from historical data and the parameters of the model. The 'yhat' column provides the predicted values ​​for each time point.
  • 'yhat_lower': is the lower bound of the predicted value, indicating the lowest predicted value at a given confidence level.
  • 'yhat_upper': is the upper bound of the predicted value, indicating the highest predicted value at a given confidence level.

The values ​​in these columns are the result of model predictions and can be used to evaluate and analyze the trend and seasonality of time series data. It is worth noting that the specific form and influencing factors of these columns depend on the characteristics of the dataset and the training results of the model. Therefore, specific values ​​and interpretations can be analyzed and interpreted in the context of the data and model.

in:

yhat = trend + daily + holidays + weekly

additive_terms = daily + holidays + weekly

As shown in the figure below, some data samples are intercepted.
insert image description here
The graph of the output week is shown in the figure below:

insert image description here
Among them, the season item is as follows:
insert image description here

According to the additive model, the predicted output of the Prophet model can be expressed as:

yhat = trend + seasonal + holidays + additional_components + error

in,

  • trend represents the trend item, which represents the overall change trend of the time series;
  • Seasonal represents a seasonal item, representing the pattern of the time series in terms of periodic changes;
  • holidays represents the holiday item, indicating the impact of a specific holiday on the time series;
  • additional_components represents other additional factors, such as custom important events, etc.;
  • error represents the error term of the model.

Additional explanation concepts:

  1. Can you explain the addition and multiplication terms in the model in a simple way?

When modeling time series data with a Prophet model, you can choose to use additive or multiplicative terms to represent the relationship between trend and seasonality.

The additive model assumes that the trend and seasonality are independent of each other, that is, the effects of trend and seasonality can be simply added. In the additive model, the value of the time series can be expressed as: original value = trend + seasonality + other factors (such as holidays, special events, etc.).

The multiplicative model assumes that the trend and seasonality interact, that is, the effects of trend and seasonality are mutually amplified or weakened. In a multiplicative model, the value of the time series can be expressed as: raw value = trend * seasonality * other factors.

The specific choice of additive model or multiplicative model depends on the characteristics of time series data and specific application scenarios. Typically, additive models are appropriate when the seasonal effect is relatively independent of the trend, while multiplicative models are appropriate when the seasonal effect is strongly correlated with the trend.

In the Prophet model, you can choose to use an additive model or a multiplicative model to model time series data by adjusting parameters. Depending on the model type selected, the model calculates corresponding estimates of trend, seasonality, and other factors to provide forecasts of future values.

  1. When it comes to practical cases, here are some examples of additive and multiplicative terms:
  • A practical example of the additive term:
    Suppose we are analyzing the daily order volume of an e-commerce platform. Additive terms can be used to represent daily order volumes made up of factors such as trends, weekly seasonality, and holidays.

    • Trend item: Indicates that the order quantity shows a trend of gradual increase or decrease over time.
    • Weekly seasonal item: Indicates the cyclical change in order volume on different days of the week, such as higher order volume on weekends and lower order volume on weekdays.
    • Holiday item: Indicates the impact of holidays on the order volume, for example, holidays such as Christmas and Thanksgiving may increase the order volume.
  • A practical example of the multiplication term:
    Suppose we are analyzing the annual production of a certain agricultural product. Multiplicative terms can be used to represent the interaction of yields with trend, seasonal and climatic factors, etc.

    • Trend item: It indicates that the output shows a trend of gradual increase or decrease over time.
    • Seasonal item: Indicates the cyclical change of production in different seasons of each year, such as higher production in spring and lower production in winter.
    • Climatic factor item: Indicates the impact of climatic factors on output, such as rainfall, temperature and other climatic factors may have an impact on output.

These are some examples of additive and multiplicative terms in practical cases, which can be adjusted and extended according to the specific application domain and characteristics of time series data. It is important to choose the appropriate modeling approach on a case-by-case basis, taking into account the impact of trend, seasonality, and other relevant factors on time-series data.

Guess you like

Origin blog.csdn.net/xiaoyw/article/details/131402812