Interval prediction | MATLAB implements QRFR random forest quantile regression multi-input single-output interval prediction

Interval prediction | MATLAB implements QRFR random forest quantile regression multi-input single-output interval prediction

List of effects

1

2
3
4
5

basic introduction

MATLAB实现QRFR随机森林分位数回归多输入单输出区间预测
Matlab实现基于QRFR随机森林分位数多变量回归区间预测模型(完整源码和数据)
1.Matlab实现基于QRFR随机森林分位数多变量回归区间预测模型;
2.基于随机森林回归(RFR)分位数多变量回归区间预测,Matlab代码,多变量输入单变量输出模型(最后一列输出),data为数据集,QRFR为主程序,其余为函数文件,无需运行;
3.评价指标包括:R2、MAE、MSE、RMsE和区间覆盖率和区间平均宽度百分比等,代码质量极高,方便学习和替换数据;
4.运行环境Matlab2018及以上。

Model description

Random Forest (Random Forest) is an integrated learning algorithm that makes predictions based on multiple decision trees, and obtains the final prediction result by voting or averaging. Random forests perform well in regression problems and can be used for multiple input single output (Multiple Input Single Output, MISO) regression tasks. The prediction interval needs to introduce quantile regression.
Quantile Regression (Quantile Regression) is a regression analysis method that can be used to predict the target value of different quantiles. In the MISO regression task, if you need to predict the range of the target value, you can use quantile regression to achieve it. Specifically, multiple random forest models can be trained, each for predicting different quantile target values. For example, one model can be trained to predict the lower quartile of target values, another model to predict the median target value, another model to predict the upper quartile of target values, and so on. These models can use the same input features but output different target values.
When it is necessary to predict the target value interval of an input sample, these random forest models can be used to predict the target values ​​of different quantiles respectively, and then they are combined to form an interval. For example, the predictions for the lower and upper quartiles can be grouped into an interval, representing the range of target values. In this way, a reliable target value interval prediction result can be obtained.

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';

%%  模型创建

%%  仿真测试


%%  数据反归一化
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/131870989