Effacer les filtres
Effacer les filtres

How to plot confusion matrix for 2 classes (genuine or fraud)

1 vue (au cours des 30 derniers jours)
Tam Swee Chin
Tam Swee Chin le 1 Avr 2021
trainingSetup = load("C:\Users\User\Desktop\Master Application\02 Dissertion\Signature\Kaggle\Real_A1\trainingSetup_2021_04_01__20_23_12.mat");
imdsTrain = imageDatastore("C:\Users\User\Desktop\Master Application\02 Dissertion\Signature\Testing","IncludeSubfolders",true,"LabelSource","foldernames");
[imdsTrain, imdsValidation] = splitEachLabel(imdsTrain,0.7,"randomized");
% Resize the images to match the network input layer.
augimdsTrain = augmentedImageDatastore([224 224 3],imdsTrain);
augimdsValidation = augmentedImageDatastore([224 224 3],imdsValidation);
opts = trainingOptions("rmsprop",...
layers = [
imageInputLayer([224 224 3],"Name","imageinput")
convolution2dLayer([3 3],32,"Name","conv","Padding","same")
maxPooling2dLayer([5 5],"Name","maxpool","Padding","same")
[net, traininfo] = trainNetwork(augimdsTrain,layers,opts);

Réponses (1)

Athul Prakash
Athul Prakash le 6 Avr 2021
Hi Tam,
First, you may set aside some of your data as test data.
With this test dataset, obtain Y_Actual as the labels and X as the values in the test data.
After that,
YPred = predict(net, X);
cmat = confusionmat(YActual, YPred);
1) Check out the doc on confusionmat and the examples found there.
2) You may also refer to confusionchart(), which creates a plot of the confusion matrix as well.
Hope it helps!


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!

Translated by