自组织神经网络(SOM)的邻域节点问题...
我现在写了一个关于通过比较训练后的自组织神经网络与数据的相似度来达到预测未来数据的趋势的方程。但是我发现可能是学习方法不对。或者是邻域节点的公式不对。预测出来的数据很多都是一样的..谁知道这个问题应该怎么解决啊?
%% data pre-process
% Training 230 data.
x = ;
% Testing 136 data.
y = ;
% Testing from 10th value of testing data
m = 10;
%% initialise model parameters
% 1x10 SOM
for i = 1
for j = 1:10
w(i,j,:) = rand(1,10);
end
end
% Training
for t = 1:5000
if rem(t,100) == 0
t
end
n = 10+floor(rand*220);
xx = ;
a = 0.5 * 100/(100+t); % learning rate
b = 0.9 + 7*100/(5000+t); % Gaussian distribution rate
for i = 1
for j = 1:10
ww = reshape(w(i,j,:),1,10);
d(i,j) = (xx-ww)*(xx-ww)';
end
end
vi = 1;
vj = 1;
for i = 1
for j = 1:10
if d(i,j)<d(vi,vj)
vj = j;
end
end
end
for i = 1
for j = 1:10
dd = (j-vj)^2;
yy = reshape(xx,1,1,10);
w(i,j,:) = w(i,j,:) + a*exp(-dd/(2*b*b))*(yy-w(i,j,:));
end
end
end
% Testing
while m < 137
zz = ;
for i = 1;
for j = 1:10;
ww1 = reshape(w(i,j,:),1,10);
xx1 = ww1(2:10);
zz1 = zz(2:10);
p(i,j) = (zz1-xx1)*(zz1-xx1)';
end
end
vx = 1;
vz = 1;
for i = 1;
for j = 1:10;
if p(i,j)<p(vx,vz);
vz = j;
end
end
end
pp(m) = w(vx,vz,1);
m = m+1;
end
页:
[1]