Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
index exceeds matrix dimension
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
| 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 comentarios
Respuestas (1)
Walter Roberson
el 9 de Jun. de 2016
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 comentarios
Walter Roberson
el 9 de Jun. de 2016
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.
La pregunta está cerrada.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!