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.小總結