(Python) Seven methods of time series forecasting

introduce

Most people have heard about Cryptocurrency, and many people may invest in their cryptocurrency. But is it safe to invest in this volatile currency? How can we ensure that investing in these coins now will bring stable returns in the future? We can't be sure, but we can certainly produce an approximation based on previous prices. A time series model is a method of forecasting.

c172116114cbe09df1d88d0a13f4836152cf7a80

In addition to cryptocurrencies, there are many important areas where time series forecasting is applied, such as: sales forecasting, call volume in call centers, sun activity, ocean tides, stock market behavior, and more.

content

  • Understand problem descriptions and datasets
  • Install the library
  • Method 1 – Start the easy way
  • Method 2 - Simple Average
  • Method 3 – Moving Average
  • Method 4 – Exponential Smoothing
  • Method 5 – Holt’s Linear Trend Method
  • Method 6 – Holt Winter Season Method
  • Method 7 – Integrated Autoregressive Moving Average Method (ARIMA)

Understand problem descriptions and datasets

Provides a timing problem involving forecasting commuter numbers on JetRail, a new high-speed rail service. We provide 2 years of data and use this data to predict the number of commuters for the next 7 months.

In this paper, only the training dataset is used.

d1b0b1f301e37af91d4f7fc48344bc40b6676350

As can be seen from the above report, we have 2 years of hourly commuting data (2012-2014), and we need to estimate the number of commutes in the future.

In this article, I construct subset and aggregate datasets to illustrate the different approaches.

  • Constructing subsets of datasets (2012/08 – 2013/12)
  • Construct train and test files for modeling. The first 14 months of data were used as training data (2012/08 - 2013/10), and the last two months were used as test data (2013/11 - 2013/12).
  • Data sets are aggregated daily.

502129a7bc70253ef7f2402ab02aac8c8c9d1c9e

Visualize data (for training and testing) to understand how it has changed over time.

8123d8776fc5e5f3ab200e37c62e215d480cd914

40518e84f12b411a3c21b6ae46003b76acaf4f02

Install the library (statsmodels)

The library used for time series forecasting is statsmodels. Before applying few of the given methods, it needs to be installed. statsmodels may already be installed in your Python development environment, but it does not support the prediction method. We'll clone it from the repository and install it from source. Follow the steps below:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325138322&siteId=291194637