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!