error ??? Index exceeds matrix dimensions.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Muhamad Jaliluddin Mazlan
el 5 de Dic. de 2013
Respondida: Greg Heath
el 6 de Dic. de 2013
%
--------------------------------------------------------------------------
%define input and output for training
in=d(1:40,1:1000);
ou=d(41:40,1:1000);
trainInput= d(1:40,201:1000); % input for training
trainOutput= d(41:40,201:1000); % output for training
%--------------------------------------------------
% training the MLP Neural network
% newff(input, target,[hidden layer1 hiddenlayer2 output],{transferFunction1 transferFunction2 transferFunction3});
% transferFunction defult for hidden layer is tansig but here use logsig
% and purelin is default transferFunction for output layer
net = newff(minmax(in),ou,[10 10 4],{'logsig' 'logsig' 'purelin'});
%--------------------------------------------------------------------------
% Setting the parameters for training
net.trainParam.epochs = 1000; %set the maximum number of epochs to train
net.trainParam.goal = 0.02; %sum-squared error goal.
%--------------------------------------------------------------------------
% training the MLP by using a a train function
net = train(net,trainInput,trainOutput);
%--------------------------------------------------------------------------
% To draw the result making the testing
testInput=d(1:40,1:200); % extract certain column for testing input
testResult1=sim(net,testInput); % simulate the MLP network by using a sim function
testResult1 = testResult1';
trainOutput2= d(1:40,1:200);
??? Index exceeds matrix dimensions.
above is my code for fold 1 (train set is 201-1000, test set is 1-200) i use dataset 1000x40 double Any expert can u help me...thank you!!!
1 comentario
kjetil87
el 5 de Dic. de 2013
I didnt check the entire code but It migh be because of
ou=d(41:40,1:1000);
this is and empty matrix... Correct syntax is
ou=d(41:-1:40,1:1000);
Respuesta aceptada
Greg Heath
el 6 de Dic. de 2013
Did it ever occur to you that it is self defeating to include code with a data set that is not accessible to those who want to help you?
In the future try your code on a MATLAB data set before posting. That way you can separate code errors from data errors and get a headstart on receiving focused help.
help nndatasets
doc nndatasets
Either use all of the chosen MATLAB dataset or a subset of it to best match the size of your data.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%define input and output for training
in=d(1:40,1:1000);
ou=d(41:40,1:1000);
'1. ERRONEOUS INDEXING'
trainInput= d(1:40,201:1000); % input for training
trainOutput= d(41:40,201:1000); % output for training
'2.ERRONEOUS INDEXING'
%--------------------------------------------------
% training the MLP Neural network
% newff(input, target,[hidden layer1 hiddenlayer2 output], ...
% {transferFunction1 transferFunction2 transferFunction3});
% transferFunction defult for hidden layer is tansig but here use logsig
% and purelin is default transferFunction for output layer
net = newff(minmax(in),ou,[10 10 4],{'logsig' 'logsig' 'purelin'});
'3. DOUBLY OBSOLETE FUNCTION. USE FITNET.'
'4. ONE HIDDEN LAYER IS SUFFICIENT'
'5. BIPOLAR TANSIG IS BETTER FOR HIDDEN LAYERS THAN UNIPOLAR LOGSIG'
'6. 4 OUTPUT NODES IS ERRONEOUS'
%--------------------------------------------------------------------------
% Setting the parameters for training
net.trainParam.epochs = 1000; %set the maximum number of epochs to train
'7. epochs = 1000 IS A DEFAULT. WHY BOTHER?'
net.trainParam.goal = 0.02; %sum-squared error goal.
'8. WHAT IS THE RATIONALE FOR THIS CHOICE??...(I ASSUME YOU MEANT MSE INSTEAD OF SSE)'
%--------------------------------------------------------------------------
% training the MLP by using a a train function
net = train(net,trainInput,trainOutput);
%--------------------------------------------------------------------------
% To draw the result making the testing
testInput=d(1:40,1:200); % extract certain column for testing input
testResult1=sim(net,testInput); % simulate the MLP network by using a sim function
testResult1 = testResult1';
trainOutput2= d(1:40,1:200);
'9.ERRONEOUS INDEXING'
THANK YOU FOR FORMALLY ACCEPTING MY ANSWER
GREG
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!