Interval prediction | MATLAB implements a multivariate time series interval prediction model based on QRF random forest quantile regression

Interval prediction | MATLAB implements a multivariate time series interval prediction model based on QRF random forest quantile regression

List of effects

1
2

3
4
5

basic introduction

1. Matlab implements a multivariate time series interval prediction model based on QRF random forest quantile regression;
2. Based on random forest regression (QRF) quantile time series interval prediction, Matlab code, univariate input model, data is a data set, QRFNTS is the main program, and the rest are function files, which do not need to be run;
3. Evaluation indicators include: R2, MAE, MAPE, MSE, interval coverage and interval average width percentage, etc., the code quality is extremely high, and it is convenient to learn and replace data;

Random forest quantile regression is a learning method based on the random forest process for forecasting time series. In time series interval forecasting, RF can be used to predict quantiles for a series of future time points, thus providing some information about future trends. Specifically, RF can be used to estimate the probability distribution of observations at a given time point at a given quantile level. This distribution can be used to compute interval forecasts. The forecast results of RF can provide some uncertainty information about the future time series, which is very useful for decision makers and risk managers. When applying RF for time series interval forecasting, it is necessary to first select an appropriate Gaussian process model, and then perform parameter estimation and model training based on historical data. Once the model is trained, it can be used for forecasting and interval estimation of time series. It is important to note that RF is a complex learning method that requires certain mathematical and computer skills for effective application. In addition, the forecast results are also limited by historical data, so the sample data needs to be carefully selected when making time series interval forecasts, and the model needs to be constantly updated to reflect new data and trends.

programming

%%  数据集分析
outdim = 1;                                  % 最后一列为输出
num_size = 0.7;                              % 训练集占数据集比例
num_train_s = round(num_size * num_samples); % 训练集样本个数
f_ = size(res, 2) - outdim;                  % 输入特征维度

%%  划分训练集和测试集
P_train = res(1: num_train_s, 1: f_)';
T_train = res(1: num_train_s, f_ + 1: end)';
M = size(P_train, 2);

P_test = res(num_train_s + 1: end, 1: f_)';
T_test = res(num_train_s + 1: end, f_ + 1: end)';
N = size(P_test, 2);

%%  数据归一化
[p_train, ps_input] = mapminmax(P_train, 0, 1);
p_test = mapminmax('apply', P_test, ps_input);

[t_train, ps_output] = mapminmax(T_train, 0, 1);
t_test = mapminmax('apply', T_test, ps_output);

%%  转置以适应模型
p_train = p_train'; p_test = p_test';
t_train = t_train'; t_test = t_test';

%%  模型创建
alpha = 0.10;
net = fitrgp(p_train, t_train);

%%  仿真测试


%%  数据反归一化
L_sim1 = mapminmax('reverse', l_sim1, ps_output);
L_sim2 = mapminmax('reverse', l_sim2, ps_output);

T_sim1 = mapminmax('reverse', t_sim1, ps_output);
T_sim2 = mapminmax('reverse', t_sim2, ps_output);

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/131930628