Feed Forward Neural Network - How do I interpret the output?

I am trying to train a neural network and then use it to classify a sample set containing 4 classes (1, 2, 3 & 4).
I used my training data alongside some target group data as instructed in the newff doc.
However once the network was trained and I attempted to classify my sample using output = sim (net.sample) the result was not what I expected.
For each of my 2000 sample values the output was a column of four values ranging from -1.9 - 1.88 . I was expecting the neural network to assign a value of either 1, 2, 3, or 4 to each sample (as the SVM / nearest neighbour classification methods would). Have I gone drastically wrong somehwere or is this how the output it meant to be ?
Any advice would be greatly appreciated!

 Akzeptierte Antwort

Greg Heath
Greg Heath am 27 Apr. 2013
Use newff, newpr or patternnet with 'softmax', 'logsig' or 'purelin' as the output transfer function
For c classes use a target matrix that has columns of the c-dimensional unit matrix eye(c).
The relationships between the target matrix, integer (1:c) class index row vector, integer assigned class row vector, {0,1} error vector etc. are
target = ind2vec(classind); % columns of eye(c)
classind = vec2ind(target) % integers 1:c
net = train(net, input, target);
output = net(input);
assigned = vec2ind(output) % integers 1:c
errors = (assigned ~= classind )
Nerr = sum(errors)
Individual class performances are obtained using unique vector (NOT class) indices (1:N).
Hope this helps.
Thank you for formally accepting my answer
Greg
P.S. If you have further problem, try your code on one of the MATLAB classification datasets and we can compare.
help nndatasets

1 Kommentar

@Greg Heath the classify/predict does not work on this. then how can i draw confusion matrix or predict label with Class name

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 25 Apr. 2013

Kommentiert:

am 28 Feb. 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by