# BP网络练习

f(x)=1/x,  1<=x<=100;

BP神经网络：

clc;close all;clear;
N = 7;
P = rand(1,N);
P = P*100
T = P.^(-1)
w1 = rand(1,2);
w2 = rand(2,1);
E = 0;
Eta = 0.5;
epoch = 0;
while (epoch==0||0.5*(1/N)*E>0.00001)
E = 0;
for n=1:N
v1 = (w1')*P(n);
y1 = (exp(-1*v1)+1).^(-1);
v2 = (w2')*y1;
O = (exp(-1*v2)+1).^(-1);
e=T(n)-O;
E=E+0.5*(e.^2);
Delta2 = e*O*(1-O);
w2 = w2+Eta*Delta2*y1;
Delta1(1,1) = y1(1,1)*(1-y1(1,1))*([1 1]*(Delta2*w2));
Delta1(2,1) = y1(2,1)*(1-y1(2,1))*([1 1]*(Delta2*w2));
w1(1,1) = w1(1,1)+Eta*Delta1(1,1)*P(n);
w1(1,2) = w1(1,2)+Eta*Delta1(2,1)*P(n);
epoch = epoch+1;
end
end
e
E
epoch
w1
w2

function bpsim(w1,w2)
P = 0:1:100;
T = P.^(-1);
v1 = (w1')*P;
y1 = (exp(-1*v1)+1).^(-1);
v2 = (w2')*y1;
O = (exp(-1*v2)+1).^(-1);
hold;
plot(P,T,'r');
plot(P,O,'b');


P =

33.1665   15.2234   34.8008   12.1658   88.4153    9.4278   93.0041

T =

0.0302    0.0657    0.0287    0.0822    0.0113    0.1061    0.0108

e =

-0.0080

E =

1.4000e-004

epoch =

958895

w1 =

0.0456   -0.3060

w2 =

-4.0149
3.8677

#### 吴恩达 机器学习 神经网络编程代码练习笔记

2015-04-02 11:47:24

#### C++ 语言实现 BP 神经网络实例，手把手一句一句敲代码实现训练学习，模式识别 - （1）

2017-09-26 16:56:40

#### 通俗的例子去理解BP网络

2015-12-20 17:59:02

#### matlab实现BP神经网络

2014-05-01 17:33:39

#### 用keras实现3层BP网络的训练、保存、加载和导入自己手写的数字进行测试

2017-09-02 14:38:13

#### deep learning 深度网络和BP反馈

2015-03-26 17:16:26

#### BP网络的MATLAB仿真一般设置

2016-04-05 11:04:36

#### 模式识别算法-----BP网络设计

2016-04-15 21:03:05

#### BP网络的四个学习过程

2012-04-16 15:30:56

#### BP网络常用传递函数

2018-01-02 21:26:32