Types of Time Series Data Forecasting

The main content of this article is to use LSTM network to perform different types of time series prediction tasks. It does not involve code. It only explains different types of prediction tasks and data division.
Reference article: https://machinelearningmastery.com/how-to-develop-lstm-models-for-time-series-forecasting/

Note: The concepts involved are illustrated in the data case

The essence of time series data prediction is to use previous values ​​to predict subsequent values. After obtaining a set of data, the data need to be processed into samples. Each sample includes the previous data and the data to be predicted, which is used as a training set.

1 Univariate time series data forecasting

单变量时间序列数据Refers,In addition to time attribute data, there is only a set of data with a single attribute, such as the price of gold in 2010, which is calculated on a daily basis, that is, one data per day. There is only one attribute in the data: price, with a total of 365 data.
At the same time, univariate means that the data has only one sequence, and one variable is also a feature.
Insert image description here

1.1 Single-step prediction

The single step in single-step prediction refers to 一个时间步长(time step), for example, in the above gold price data, each day is a time step, that is, each time data is obtained in the time series data, it is a time step.

Single-step prediction is to predict data for only one time step.

Single-step prediction of univariate time series data (Univariate Step) : It is beneficial to predict the data of the next time step from the data of the previous time steps.

data processing:

数据集dateset
[10, 20, 30, 40, 50, 60, 70, 80, 90]

The small amount of data above is just a set of data with a single attribute. Before making predictions, the data must be processed into samples (assuming that 3 time step data are used to predict the next time step data). The sample structure is as follows: There are 6
samples in the following data, and the first three in each sample are One set of data at one time step is used as input, and the data at the next time step is used as another set as output.

[10 20 30] 40
[20 30 40] 50
[30 40 50] 60
[40 50 60] 70
[50 60 70] 80
[60 70 80] 90

即:
	输入			输出
[[10, 20, 30],		[40,
[20, 30, 40].		50,
……			]			]

After training a model using such data, we can use the data from the first three consecutive time steps to predict the data for the next time step.

Finally, let’s take a look at the dimensions of the input data and output data in the sample:
Input: two dimensions, the total number of samples, and the time step used for prediction, here are 6 and 3 respectively
Output: one dimension, the number of samples, here is 6

1.2 Multi-step forecasting

Multi-step forecasting of univariate time series data (Univariate Multi-Step forecasting, Univariate Multi-Step) : It is beneficial to predict the data of the following time steps from the data of the previous time steps.

This example: Use the data of 3 time steps to predict the data of the next 2 time steps,

data processing:

数据集dateset
[10, 20, 30, 40, 50, 60, 70, 80, 90]

The sample structure is as follows:
The following data has a total of 6 samples. In each sample, the data of the first three time steps are one group as input, and the data of the last two time steps are another group as output.

[10 20 30] [40 50]
[20 30 40] [50 60]
[30 40 50] [60 70]
[40 50 60] [70 80]
[50 60 70] [80 90]

即:
	输入			输出
[[10, 20, 30],		[[40,50],
[20, 30, 40],		[50,60],
……]					……		]

说明:后面的输入输出也都是这样分析,只是不再表明输入输出和完整的数组结构。

After training a model using such data, we can use the data from the first three consecutive time steps to predict the data for the next time step.

After training a model using such data, we can use the data from the first three consecutive time steps to predict the data for the next time step.

Dimensions of input data and output data:
Input: two dimensions, total number of samples, time step for prediction, here are 6, 3 respectively
Output: two dimensions, sample data, time step for prediction, here are 6 ,2

2 Multivariate Time Series Data Forecasting

多变量时间序列数据It refers to a set of data that has multiple attributes or characteristics in addition to time attributes.
Insert image description here

2.1 One-step prediction

2.1.1 Multivariate Forecasting

Single-step prediction of multi-time variable data (Multivariate single-step prediction, Multivariate Input Series) : Use part of the attribute data of multiple previous time steps to predict a certain attribute data of the next time step. Different from single variables, here each Each time step has multiple data sets. Take the power consumption data above as an example. One prediction method is to use the average current and average voltage data of three time steps to predict the average power of one time step.

Dataset processing:

[[ 10  15  25]
 [ 20  25  45]
 [ 30  35  65]
 [ 40  45  85]
 [ 50  55 105]
 [ 60  65 125]
 [ 70  75 145]
 [ 80  85 165]
 [ 90  95 185]]

Dividing samples
The following data has a total of 6 samples. In each sample, the data of the first three time steps are the average current and average voltage as input, and the average power of the next time step is used as the output.

[[10 15]
 [20 25]
 [30 35]] 65
[[20 25]
 [30 35]
 [40 45]] 85
[[30 35]
 [40 45]
 [50 55]] 105
[[40 45]
 [50 55]
 [60 65]] 125
[[50 55]
 [60 65]
 [70 75]] 145
[[60 65]
 [70 75]
 [80 85]] 165
[[70 75]
 [80 85]
 [90 95]] 185

Using this method, the current and voltage data of the first three time steps can be used to predict the current power (only current and voltage information is given).

Dimensions of input data and output data:
Input: three dimensions, total number of samples, time step used for prediction, number of features used for prediction, here are 6, 3, 2 respectively Output: two
dimensions, sample data, prediction The number of features, here are 6, 1 respectively

2.1.2 Parallel forecasting (full variable forecasting)

Multivariate Multi-Step Parallel Series : Use all attribute data of the previous time steps to predict all attribute data of the next time step. Taking the above power consumption data as an example, use the average current, average voltage, and average power of the first three time steps to predict theoneAverage current, average voltage, and average power over time.

data set:

[[ 10  15  25]
 [ 20  25  45]
 [ 30  35  65]
 [ 40  45  85]
 [ 50  55 105]
 [ 60  65 125]
 [ 70  75 145]
 [ 80  85 165]
 [ 90  95 185]]

Sample processing:

[[10 15 25]
 [20 25 45]
 [30 35 65]] [40 45 85]
[[20 25 45]
 [30 35 65]
 [40 45 85]] [ 50  55 105]
[[ 30  35  65]
 [ 40  45  85]
 [ 50  55 105]] [ 60  65 125]
[[ 40  45  85]
 [ 50  55 105]
 [ 60  65 125]] [ 70  75 145]
[[ 50  55 105]
 [ 60  65 125]
 [ 70  75 145]] [ 80  85 165]
[[ 60  65 125]
 [ 70  75 145]
 [ 80  85 165]] [ 90  95 185]

In this way, the current, voltage, and power data of the first three time steps can be used to predict the current, voltage, and power of the next time step during prediction.

Dimensions of input data and output data:
Input: three dimensions, total number of samples, time step used for prediction, number of features used for prediction, here are 6, 3, 3 respectively Output: two
dimensions, sample data, prediction The number of features, here are 6, 3 respectively

2.2 Multi-step forecasting

2.2.1 Multivariate Forecasting

Multi-step prediction of multi-time variable data (Multiple Input Multi-Step Output) : Use part of the attribute data of the previous time steps to predict a certain attribute data of the following time steps. Taking the power consumption data above as an example, one prediction method is to use the average current and average voltage of the first three time steps to predict the following2Average power over time steps.
data set:

[[ 10  15  25]
 [ 20  25  45]
 [ 30  35  65]
 [ 40  45  85]
 [ 50  55 105]
 [ 60  65 125]
 [ 70  75 145]
 [ 80  85 165]
 [ 90  95 185]]

Sample processing:

[[10 15]
 [20 25]
 [30 35]] [65 85]
[[20 25]
 [30 35]
 [40 45]] [ 85 105]
[[30 35]
 [40 45]
 [50 55]] [105 125]
[[40 45]
 [50 55]
 [60 65]] [125 145]
[[50 55]
 [60 65]
 [70 75]] [145 165]
[[60 65]
 [70 75]
 [80 85]] [165 185]

In this way, the current and voltage data of the first three time steps can be used to predict the average power of the next two time steps.

Dimensions of input data and output data:
Input: three dimensions, total number of samples, time step used for prediction, number of features used for prediction, here are 6, 3, 2 respectively Output: two
dimensions, sample data, prediction The time step size, here are 6, 2

2.2.2 Parallel forecasting (full variable forecasting)

Multi-step parallel prediction of multi-variable time series data (Multiple Parallel Input and Multi-Step Output) : Use all attribute data of the previous time steps to predict all attribute data of the next time step. Taking the above power consumption data as an example, use the average current, average voltage, and average power of the first three time steps to predict the followingmultipleAverage current, average voltage, and average power over time.

data set:

[[ 10  15  25]
 [ 20  25  45]
 [ 30  35  65]
 [ 40  45  85]
 [ 50  55 105]
 [ 60  65 125]
 [ 70  75 145]
 [ 80  85 165]
 [ 90  95 185]]

Sample processing:

(5, 3, 3) (5, 2, 3)

[[10 15 25]
 [20 25 45]
 [30 35 65]] [[ 40  45  85]
 [ 50  55 105]]
[[20 25 45]
 [30 35 65]
 [40 45 85]] [[ 50  55 105]
 [ 60  65 125]]
[[ 30  35  65]
 [ 40  45  85]
 [ 50  55 105]] [[ 60  65 125]
 [ 70  75 145]]
[[ 40  45  85]
 [ 50  55 105]
 [ 60  65 125]] [[ 70  75 145]
 [ 80  85 165]]
[[ 50  55 105]
 [ 60  65 125]
 [ 70  75 145]] [[ 80  85 165]
 [ 90  95 185]]

In this way, the current, voltage, and power data of the first three time steps can be used to predict the current, voltage, and power of the next two time steps.

Dimensions of input data and output data:
Input: three dimensions, total number of samples, time step used for prediction, number of features used for prediction, here are 6, 3, 2 respectively
Output: three dimensions, sample data, prediction The time step and number of predicted features are 6, 2, and 3 respectively.

Guess you like

Origin blog.csdn.net/baidu_40120883/article/details/129132817