Interval prediction | MATLAB implements multivariate time series interval prediction based on QRCNN-LSTM convolutional long short-term memory neural network

Interval prediction | MATLAB implements multivariate time series interval prediction based on QRCNN-LSTM convolutional long short-term memory neural network

List of effects

1
2
3
4
5

6 descriptions

basic introduction

1. Matlab implements multivariate time series interval prediction based on QRCNN-LSTM convolutional neural network combined with long-term and short-term memory neural network;
2. Multi-map output, point prediction and multi-index output (MAE, MAPE, RMSE, MSE, R2), interval prediction Multi-indicator output (interval coverage rate PICP, interval average width percentage PINAW), multi-input single-output, including point prediction map, different confidence interval prediction map, error analysis map, kernel density estimation probability density map; 3.data is a data set
, The power data set uses multiple associated variables to predict the last column of power data, which is also applicable to load forecasting and wind speed forecasting; MainQRCNN_LSTMNTS is the main program, and the rest are function files, which do not need to be run; 4. The code is of high quality, with clear comments and
data In the preprocessing part, missing values ​​are processed, and if it is nan, it is deleted, and kernel density estimation is also included;
5. The operating environment is Matlab2021 and above.

Model description

Convolutional long short-term memory neural network is a model that combines convolutional neural network and long short-term memory neural network, which can model and predict time series data. Multivariate time series interval prediction refers to the prediction of multiple variables within a certain time range.
The following is an example of a basic convolutional LSTM model for multivariate time series interval prediction:
Data preparation: Multiple variables are used as input to the model to form a three-dimensional tensor, where the first dimension represents the time step and the second dimension represents variables, and the third dimension represents features.
Model construction: The model includes convolutional layers, LSTM layers, and fully connected layers. The convolutional layer is used to extract local features in the time series, the LSTM layer is used to capture the long-term dependencies in the sequence, and the fully connected layer is used to convert the output of the LSTM layer into the desired prediction result.
Model training: Use known time series data for model training and verify it on the validation set. The performance of the model can be evaluated using metrics such as Mean Squared Error (MSE) or Mean Absolute Error (MAE).
Model prediction: Use the trained model to predict multiple variables within a certain time range in the future.
It should be noted that the prediction results of the convolutional LSTM model may be affected by multiple factors, such as the selection of input variables, the design of the model structure, and the adjustment of hyperparameters. Therefore, in practical applications, it needs to be adjusted and optimized according to the specific situation to achieve better prediction results.

programming

  • Complete program and data acquisition method: private message blogger.
ntrain=round(nwhole*num_size);
	ntest =nwhole-ntrain;
	% 准备输入和输出训练数据
	input_train =input(:,temp(1:ntrain));
	output_train=output(:,temp(1:ntrain));
	% 准备测试数据
	input_test =input(:, temp(ntrain+1:ntrain+ntest));
	output_test=output(:,temp(ntrain+1:ntrain+ntest));
	%% 数据归一化
	method=@mapminmax;
	[inputn_train,inputps]=method(input_train);
	inputn_test=method('apply',input_test,inputps);
	[outputn_train,outputps]=method(output_train);
	outputn_test=method('apply',output_test,outputps);
	% 创建元胞或向量,长度为训练集大小;
	XrTrain = cell(size(inputn_train,2),1);
	YrTrain = zeros(size(outputn_train,2),1);
	for i=1:size(inputn_train,2)
		XrTrain{
    
    i,1} = inputn_train(:,i);
		YrTrain(i,1) = outputn_train(:,i);
	end
	% 创建元胞或向量,长度为测试集大小;
	XrTest = cell(size(inputn_test,2),1);
	YrTest = zeros(size(outputn_test,2),1);
	for i=1:size(input_test,2)
		XrTest{
    
    i,1} = inputn_test(:,i);
		YrTest(i,1) = outputn_test(:,i);
	end

	%% 创建混合CNN-LSTM网络架构
%%  区间覆盖率
RangeForm = [T_sim(:, 1), T_sim(:, end)];
Num = 0;

for i = 1 : length(T_train)
    Num = Num +  (T_train(i) >= RangeForm(i, 1) && T_train(i) <= RangeForm(i, 2));
end

picp = Num / length(T_train);     


    S = cumtrapz(X,Y);
    Index = find(abs(m-S)<=1e-2);
    Q = X(max(Index));

References

[1] https://blog.csdn.net/kjm13182345320/article/details/127931217
[2] https://blog.csdn.net/kjm13182345320/article/details/127418340

Guess you like

Origin blog.csdn.net/kjm13182345320/article/details/131040757