%% 划分训练集和测试集
P_train = res(1: num_train_s, 1: f_)';
T_train = res(1: num_train_s, f_ + 1: end)';
P_test = res(num_train_s + 1: end, 1: f_)';
T_test = res(num_train_s + 1: end, f_ + 1: end)';
%% 划分训练集和测试集
M = size(P_train, 2);
N = size(P_test, 2);
or_dim = size(P_train,1) ; % 记录特征数据维度
n_out = 1 ; % % 预测步长
% 数据归一化
[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);
%% 数据平铺
for i = 1:size(p_train,2)
trainD{i,:} = (reshape(p_train(:,i),or_dim,[]));
end
for i = 1:size(p_test,2)
testD{i,:} = (reshape(p_test(:,i),or_dim,[]));
end
targetD = t_train';
targetD_test = t_test';
%% 优化算法参数设置
智能算法及其模型预测
标签:Transformer,end,变量,%%,num,train,bayes,test,size From: https://blog.csdn.net/qq_43916303/article/details/142989104