bp神经网络学习笔记

  • supervised learning
  • bp is a method of teaching artificial neural networks how to perform a task
  • activation function->differentiable

思路:

phase 1

输入->计算->比较->反馈

phase 2

反向传回->更新权值->收敛
  • 梯度下降法
  • 数据归一化

exp:通过近红外光谱分析(NIR)进行辛烷浓度预测

load spectra_data.mat
temp=randperm(size(NIR,1));

%将数据随机划分为两类train&test
p_train=NIR(temp(1:50),:)';
r_train=octane(temp(1:50),:)';
p_test=NIR(temp(51:end),:)';
r_test=octane(temp(51:end),:)';
N=size(p_test,2);

%数据归一化
[fp_train,stru]=mapminmax(p_train,0,1);
fp_test=mapminmax('apply',p_test,stru);
[fr_train,stru1]=mapminmax(r_train,0,1);

%创建前向神经网络/参数设置
net=newff(fp_train,fr_train,9);%九个神经元
net.trainParam.epochs=1000;
net.trainParam.goal=1e-3;
net.trainParam.lr=0.01;

net=train(net,fp_train,fr_train);
test=sim(net,fp_test);
result_sim=mapminmax('reverse',test,stru1);
err=abs(result_sim-r_test)./r_test

figure
plot(1:N,r_test,1:N,result_sim)

regress
regress

数据对比
数据对比


版权声明:本文为weixin_42882826原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。