Azzera filtri
Azzera filtri

[c] = confusion(t,y) and not classified observations

4 visualizzazioni (ultimi 30 giorni)
Hi
[c] = confusion(t,y)
[c] its Confusion value = fraction of samples misclassified
but output of code bellow can be values:
1)classified correctly
2)classified incorrectly
3)not classified
net = fitnet(hl,trainFcn)
[net,tr] = train(net,x,t);
y = net(x)
[c] = confusion(t,y)
if im getting c = 0 it mean all values were classified correctly but it will consider values which were not classified ?

Risposte (1)

Srivardhan Gadila
Srivardhan Gadila il 28 Mar 2020
Modificato: Srivardhan Gadila il 28 Mar 2020
The fitnet function is used for regression. The confusion matrix is used for classification problems.
Function fitting is the process of training a neural network on a set of inputs in order to produce an associated set of target outputs. After you construct the network with the desired hidden layers and the training algorithm, you must train it using a set of training data. Once the neural network has fit the data, it forms a generalization of the input-output relationship. You can then use the trained network to generate outputs for inputs it was not trained on.
Refer to confusion, plotconfusion & confusionmat for more information
  3 Commenti
Srivardhan Gadila
Srivardhan Gadila il 29 Mar 2020
@Tomasz Kaczmarski, Try the following in MATLAB:
help simpleclass_dataset
[x,t] = simpleclass_dataset;
plot(x(1,:),x(2,:),'+')
net = patternnet(10);
net = train(net,x,t);
view(net)
y = net(x)
plotconfusion(t,y)
% or use the below one
[c,cm,ind,per] = confusion(t,y)
Tomasz Kaczmarski
Tomasz Kaczmarski il 30 Mar 2020
Modificato: Tomasz Kaczmarski il 30 Mar 2020
thanks your code is doing what what im trying to achive (plotting confusion for each class on matrix)
however when i run
x = TrainSetArray';
%x = noiseSignal';
t = TargetSet';
%t = categorical(Tb(:,(563:563)));
trainFcn = 'trainlm'; % Levenberg-Marquardt backpropagation.
% Create a Fitting Network
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize,trainFcn);
hiddenLayerSize = 1;
net = fitnet(hiddenLayerSize,trainFcn);
% Train the Network
[net,tr] = train(net,x,t);
%get output
y = net(x);
plotconfusion(t,y)
im getting below, its caused by different y (output value) ? how to transform y to get output like yours to not be 0,1 but 1,2,3,4 on both axis

Accedi per commentare.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by