Effacer les filtres
Effacer les filtres

How to calculate scores from neural network classification ?

3 vues (au cours des 30 derniers jours)
Pradya Panyainkaew
Pradya Panyainkaew le 16 Avr 2018
Hi everyone
I try to classify binary classes problem by using neural network classification (the raw data are attached in this post) and evaluate this network performance by using "perfcurve" function to find the area under curve (AUC) value.
The code below show how I classify my data.
t_train=zeros(2,size(TrainSet_holiday,1));
t_test=zeros(2,size(TestSet_holiday,1));
for b1=1:size(TrainSet_holiday,1)
if Y_train_holiday(b1,1)==0
t_train(1,b1)=1;
else
t_train(2,b1)=1;
end
end
for b2=1:size(TestSet_holiday,1)
if Y_test_holiday(b2,1)==0
t_test(1,b2)=1;
else
t_test(2,b2)=1;
end
end
x_train=TrainSet_holiday';
x_test=TestSet_holiday';
setdemorandstream(391418381)
%%%%%%%%This code below is network training process %%%%%%%%%
net = patternnet(10);
view(net);
[net,tr] = train(net,x_train,t_train);
nntraintool
figure(1)
plotperform(tr)
testX = x_train(:,tr.testInd);
testT = t_train(:,tr.testInd);
testY = net(testX);
testIndices = vec2ind(testY);
figure(2)
plotconfusion(testT,testY)
[c_train,cm_train,ind_train,per_train] = confusion(testT,testY);
fprintf('Percentage Correct Classification of train set : %f%%\n', 100*(1-c_train));
fprintf('Percentage Incorrect Classification of train set : %f%%\n', 100*c_train);
figure(3)
plotroc(testT,testY)
title({'ROC Curve of Train Set for Classification by Neural network classification',['Cluster number : ' num2str(ClusterNo_holiday) ' on holiday']})
%%%%%%%%This code below is predicted output by using trained network %%%%%%%%%
Output_predicted=net(x_test);
testIndices_output = vec2ind(Output_predicted);
figure(4)
plotconfusion(t_test,Output_predicted)
title({'Confusion Matrix of Test Set on holiday',['Cluster number : ' num2str(ClusterNo_holiday)]})
[c_test,cm_test,ind_test,per_test] = confusion(t_test,Output_predicted);
fprintf('Percentage Correct Classification of output from prediction in test set : %f%%\n', 100*(1-c_test));
fprintf('Percentage Incorrect Classification of output from prediction in test set : %f%%\n', 100*c_test);
figure(5)
plotroc(t_test,Output_predicted)
title({'ROC Curve of Test Set for Classification by Neural network classification',['Cluster number : ' num2str(ClusterNo_holiday) ' on holiday']})
However, the "perfcurve" function require variable name "scores" and I don't know how to find this variable from neural network toolbox. Thus, are there any ways to solve my problem.
Thank you in advance for your suggestion
Pradya

Réponses (0)

Catégories

En savoir plus sur Function Approximation, Clustering, and Control 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