clear all;
close all;
clc;
%% 导入数据
P_train = xlsread('data','training set','B2:G191')';
T_train= xlsread('data','training set','H2:H191')';
% 测试集——44个样本
P_test=xlsread('data','test set','B2:G45')';
T_test=xlsread('data','test set','H2:H45')';
%% 优化参数设置
SearchAgents = 10; % 种群数量 50
Function_name='LSTM_MIN';
Max_iterations = 10; % 迭代次数 10
lowerbound = [10 0.001 10 ];%三个参数的下限
upperbound = [200 0.02 200 ];%三个参数的上限
dimension = 3;%数量,即要优化的LSTM参数个数
fitness = @(x)LSTM_MIN(x,P_train,P_test,T_train,T_test);
%% WOA优化LSTM
[Best_score,Best_pos,Convergence_curve]=SSA(SearchAgents,Max_iterations,lowerbound,upperbound,dimension,fitness)
save file2
%% 寻优得到的参数进行赋值
clear all;clc;close all;warning off;
load file2