在Matlab中理解GRNN

时间:2015-03-23 12:02:17

标签: matlab neural-network

嗨我有一个指纹识别系统,我正在添加一个GRNN,我的问题是GRNN已经半实现了,当它给我改进时,我以前从未使用过Matlab。我觉得我在一个我不知道的程序中被抛到了深处,并且对于GRNN如何工作,如何实现以及如何理解输出几乎没有帮助。这是已经添加的GRNN代码,它确实提供输出但是我的Matlab知识很少,解释输出很棘手。欢迎任何和所有帮助。

function btrain(P,T)

P = dlmread('featresToTrain.txt'); %features matrix 57x198
T = dlmread('target2.txt'); %these are the targets 50x1 but that should have been 57x1
%P = P(:,149);

P = P(1:51,1:21);
[r c] = size(P);
for i = 1:r
    s = sum(P(i,:));
    P(i,c+1) = s;
end

 %so 50 are used here P(rows 1 to 50,columns 1 to 20) 
%net = newff(P',T',[8 1],{'tansig','purelin'});

 tic;
 net = newgrnn(P',T');
AA = net(P')
 toc
for i=1:r
test = P(i,:);
out = sim(net,test');
out,i;
end
figure,
plot(P,T)

% net = init(net);
% net.trainParam.epochs= 1000;
% net.trainParam.min_grad = 1e-9;
% net.trainParam.goal = 0.000001;
% net.performParam.ratio=0.5;
% 
% [net,tr] = train(net,P',T');
% x = net.IW;
% inputWeights = x{1};
% dlmwrite('inputWeights.txt',inputWeights);
% x = net.LW;
% layerWeights = x{2,1};
% dlmwrite('layerWeights.txt',layerWeights);
% x = net.b;
% baises = x{1};
% dlmwrite('baises.txt',baises);

test = dlmread('featresToTest.txt'); %[22 45 124 111 160 222 301 183 252 224 270 151 291 272 267 214 286 142 41 181];

round(out)
end

谢谢!

0 个答案:

没有答案