How to plot confusion matrix for 2 classes (genuine or fraud)
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
clc
clear
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",...
"ExecutionEnvironment","auto",...
"InitialLearnRate",0.001,...
"Shuffle","every-epoch",...
"Plots","training-progress",...
"ValidationData",augimdsValidation);
layers = [
imageInputLayer([224 224 3],"Name","imageinput")
convolution2dLayer([3 3],32,"Name","conv","Padding","same")
reluLayer("Name","relu")
maxPooling2dLayer([5 5],"Name","maxpool","Padding","same")
fullyConnectedLayer(2,"Name","fc")
softmaxLayer("Name","softmax")
classificationLayer("Name","classoutput")];
[net, traininfo] = trainNetwork(augimdsTrain,layers,opts);
0 Commenti
Risposte (1)
Athul Prakash
il 6 Apr 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!
0 Commenti
Vedere anche
Categorie
Scopri di più su Deep Learning Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!