rbf_fixed.m

来自「This manual describes how to run the Mat」· M 代码 · 共 40 行

M
40
字号
function [w,y,c] = rbf_fixed(P,T,c);

% 
% RBF_FIXED:	Radial Basis Function Network with Fixed Centers Selected at Random
% 					(S. Haykin, pp. 299, 1999)
%
% function [w,y] = rbf_fixed(P,T,pnc)
% w	-> weight matrix (m1 x no)
% y	-> network output (np x no)
% P	-> input patterns (np x ni)
% T	-> desired output (np x no)
% c	-> centers determined by aiNet
%
% Copyright (c) by Leandro Nunes de Castro
% Ph.D. at UNICAMP 
% August, 2000
%

[np,ni] = size(P);
m1 = size(c,1);
if nargin == 2, m1 = round(np/2); end;
aux = randperm(np);
% m1 = round(np * pnc);
%m1 = nc;
%c = P(aux(1:m1),:);

% Input layer
sig = max(max(dist(c,c')))/sqrt(2*m1);
x = dist(P,c')./sig;
G = exp(-(x.*x)./2);		% Normalized RBF

% Output layer
w = pinv(G)*T;			% Linear weights in the output layer

% Network output
y = G*w;

% disp(sprintf('Network architecture [ni,nh,no]: [%d,%d,%d]',ni,m1,size(y,2)));
% plot(P,T,'+'); hold on; plot(P,y,'r'); title('+: Training, - : RBF output'); hold off;
% axis([min(P)-1 max(P)+1 min(T)-.1 max(T)+.1]); hold off;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?