Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
index exceeds matrix dimension
조회 수: 1 (최근 30일)
이전 댓글 표시
| This is my code i get the error index matrix dimensions in this line: network.meansqrerr {n} = plus( network.meansqrerr {n}, mse( network.error));|
function network = BUILD(inputs, targets, iterations)
% regle pour determiner le noombre des neurones dans la couche caheée
% source: stackoverflow
% Determiner hidden neuroness ( dans la couche caché couche2)
% round pour les virgules
nhidden = round((size(inputs, 1) + size(targets, 1)) * 2 / 3);
% %
% fprintf(' le nombre des couches cachés est: ')
disp(nhidden) ;
a= size(inputs, 1);
b= size(inputs, 1);
disp (a);
disp(b);
% Create a neural network
% on determine le nombre des neurones dans chaque couche
% couche1: le nombre des entrées
% couche 3 (output) le nombre des classe
network = Create(size(inputs, 1), nhidden, size(targets, 1));
% Iteration variables
% SOMME Des erreurs quadratique
n = 1;
% Train network jusk le max des iterations
%zeros_quat(zeros (10,1));
while n <= iterations
network.meansqrerr{n} = [ 0 0 0 0 ];
% Training epoch
% nombre des colonnes : size(inputs, 2)
for i=1:size(inputs, 2)
% Train network with inputs and target value
network = traine(network, inputs(:,i), targets(:,i));
% % Update sum squared error
network.meansqrerr {n} = plus( network.meansqrerr {n}, mse( network.error));
disp(['Iteration: ', num2str(n), ' / ' 'Error: ', num2str(double(network.meansqrerr{n}) )]);
%
%
% % afficher les erreurs dans chaque iteration
% disp(['Iteration: ', num2str(n), ' / ' 'Error: ', num2str(network.meansqrerr(n) )]);
% %
%
% Update iteration number
n = n + 1;
end
% afficher les poids
end
댓글 수: 0
답변 (1개)
Walter Roberson
2016년 6월 9일
You initialize
network.meansqrerr{n} = [ 0 0 0 0 ];
but you iterate
while n <= iterations
When your n exceeds 4, then network.meansqrerr{n} does not exist in the statement
network.meansqrerr {n} = plus( network.meansqrerr {n}, mse( network.error));
By the way: it is confusing that you do
a= size(inputs, 1);
b= size(inputs, 1);
If you intend both variables to be the same then why not use
b = a;
??
댓글 수: 7
Walter Roberson
2016년 6월 9일
Which mse routine are you using?
Please post the complete error message, everything in red, including the part where it says which array the problem is with.
이 질문은 마감되었습니다.
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!