1 注意:若矩阵不为方阵,则采用伪逆!
2.简单神经网络,用于线性可分。
3.依然仅一个神经元,但做了空间转换,解决非线性分类问题
4.简单小例子
5.RBF定义
.
6.小例子
7.代码
=====rbf_approx======
- clc;
- clear;
- close all;
- ld=400; %generate the 400 learing data
- x=rand(2,ld); %0-1, two dimention vector
- x=(x-0.5)*1.5*2; %-1.5, 1.5
- x1=x(1,:);
- x2=x(2,:);
- F=20+x1.^2-10*cos(2*pi*x1)+x2.^2-10*cos(2*pi*x2);
- % x is input,F is ouput.F is indeed not known by the learner. Now ,the
- %RBF network is trained.
- net=newrb(x,F);
- %generate the testing data
- interval=0.1;
- [i, j]=meshgrid(-1.5:interval:1.5);
- row=size(i);
- tx1=i(:);
- tx1=tx1';
- tx2=j(:);
- tx2=tx2';
- tx=[tx1;tx2];
- %testing,tx is testing data,ty is sim output,using our RBF.
- ty=sim(net,tx);
- v=reshape(ty,row);
- figure
- subplot(1,3,2)
- mesh(i,j,v);% v is testing output data.
- 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.
- zlim([0,60])%plot the errorsubplot(1,3,3)mesh(x1,x2,F-v);zlim([0,60])
====rbf_exact====
- %Generate some training data
- clc;
- clear;
- interval=0.01;
- x1=-1.5:interval:1.5;
- x2=-1.5:interval:1.5;
- F = 20+x1.^2-10*cos(2*pi*x1)+x2.^2-10*cos(2*pi*x2);
- net=newrbe([x1;x2],F)
- ty=sim(net,[x1;x2]);
- figure
- plot3(x1,x2,F,'g');
- figure
- plot3(x1,x2,ty,'b');
8.运行结果
9.小总结