RBF神经网络

1 注意:若矩阵不为方阵,则采用伪逆!


2.简单神经网络,用于线性可分。


3.依然仅一个神经元,但做了空间转换,解决非线性分类问题


4.简单小例子



5.RBF定义




.






6.小例子





7.代码

=====rbf_approx======

[cpp]  view plain copy
  1. clc;  
  2. clear;  
  3. close all;  
  4.   
  5.   
  6. ld=400; %generate the 400 learing data  
  7.   
  8. x=rand(2,ld); %0-1, two dimention vector  
  9. x=(x-0.5)*1.5*2; %-1.5, 1.5  
  10. x1=x(1,:);  
  11. x2=x(2,:);  
  12. F=20+x1.^2-10*cos(2*pi*x1)+x2.^2-10*cos(2*pi*x2);  
  13.   
  14.   
  15. % x is input,F is ouput.F is indeed not known by the learner. Now ,the  
  16. %RBF network is trained.  
  17. net=newrb(x,F);  
  18.   
  19. %generate the testing data  
  20. interval=0.1;  
  21. [i, j]=meshgrid(-1.5:interval:1.5);  
  22. row=size(i);  
  23. tx1=i(:);  
  24. tx1=tx1';  
  25. tx2=j(:);  
  26. tx2=tx2';  
  27. tx=[tx1;tx2];  
  28.   
  29. %testing,tx is testing data,ty is sim output,using our RBF.  
  30. ty=sim(net,tx);  
  31.   
  32. v=reshape(ty,row);  
  33. figure  
  34. subplot(1,3,2)  
  35. mesh(i,j,v);% v is testing output data.  
  36.   
  37. zlim([0,60])%plot the original functioninterval=0.1;[x1, x2]=meshgrid(-1.5:interval:1.5);F = 20+x1.^2-10*cos(2*pi*x1)+x2.^2-10*cos(2*pi*x2);subplot(1,3,1)mesh(x1,x2,F);% F is real function output data.  
  38. zlim([0,60])%plot the errorsubplot(1,3,3)mesh(x1,x2,F-v);zlim([0,60])  


 
====rbf_exact==== 

[cpp]  view plain copy
  1. %Generate some training data  
  2. clc;  
  3. clear;  
  4. interval=0.01;  
  5. x1=-1.5:interval:1.5;  
  6. x2=-1.5:interval:1.5;  
  7. F = 20+x1.^2-10*cos(2*pi*x1)+x2.^2-10*cos(2*pi*x2);  
  8. net=newrbe([x1;x2],F)  
  9.   
  10. ty=sim(net,[x1;x2]);  
  11. figure  
  12. plot3(x1,x2,F,'g');  
  13. figure  
  14. plot3(x1,x2,ty,'b');  


8.运行结果



9.小总结




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值