[net,tr,Y,E]=train(net,P,T); How Y and E get their dimensions with this syntax?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello
I am training a neural network with EEG dataset.
I have Input Matrix P with [m n] = size(P) m = 100 n = 45
and I manually created target T as [m n] = size(T) m = 100 n = 45
after this I am training my network with code below:
net=newff(P,T,2,{'logsig','purelin'},'traingd');
net.trainParam.show = 30;
net.trainParam.lr = 0.01;
net.trainParam.epochs = 30000;
net.trainParam.goal = 0;
[net,tr,Y,E]=train(net,P,T);
After this stage, I get Y and E as:
[m n] = size(Y) m = 100 n = 27
and [m n]= size(E) m = 100 n = 27
I am not able to understand how it is deciding n=27.
This value is creating trouble ahead for me as I move forward with my code:
%% Evaluate network performance and plot results % evaluate performance: decoding network response
[m,i] = max(T); % target class
[m,j] = max(Y); % predicted class
Ns = length(Y); % number of all samples
k = 0; % number of missclassified samples
if find(i-j), % if there exist missclassified samples
k = length(find(i-j)); % get a number of missclassified samples
end
fprintf('Correct classified samples: %.1f%% samples\n', 100*(N-k)/N)
it is not able to execute if statement as i and j are not of the same size and I am getting an error
??? Error using ==> minus Matrix dimensions must agree.
Please suggest a working solution. I am using Matlab R2010a so cannot proceed with feedforward net.
4 commentaires
Mohamed Nedal
le 10 Sep 2018
Hello, in the LHS "[net,tr,Y,E]", What does "E" stands for? Is that the error of the network?
Réponses (1)
Greg Heath
le 28 Avr 2017
For pattern recognition use NEWPR which is the special case of NEWFF that is designed for classification and pattern recognition
(NEWFIT is the special case for curve fitting and regression).
For classification of N I-dimensional "I"nput vectors into c distinct classes, the N target vectors should be [0,1] c-dimensional unit vectors.
[ I N ] = size(input)
[ c N ] = size(target)
with sum(target) = ones(1,N)
For examples search the NEWSGROUP and ANSWERS with
greg NEWPR
also check the similar use of the latest classifier
greg PATTERNNET
Hope this helps.
Thank you for formally accepting my answer
Greg
0 commentaires
Voir également
Catégories
En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!