当前位置:   article > 正文

果蝇优化算法FOA优化BPNN_foa-bpnn

foa-bpnn

load data input output

%划分训练集
random_num = rand(1,2000);
[value,index] = sort(random_num);
x_train = input(index(1:1800),:)';
y_train = output(index(1:1800));
x_test = input(index(1801:2000),:)';
y_test = output(index(1801:2000));

%设置BP网络节点数
inputnum = 2;
hiddennum = 5;
outputnum = 1;

%数据归一化
[input_train,inputps] = mapminmax(x_train);
[output_train,outputps] = mapminmax(y_train);

%确定待优化参数的数目
length = inputnum*hiddennum+hiddennum+hiddennum*outputnum+outputnum;

%建立BPNN
net = newff(input_train,output_train,hiddennum);

%设置FOA参数(种群规模sizepop 迭代次数k 种群初始位置x_asis+y_asis)
sizepop = 10;
k = 100;

x_asis = rand(1,length);
y_asis =

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/525518
推荐阅读
相关标签
  

闽ICP备14008679号