Effacer les filtres
Effacer les filtres

How to obtain a ROC curve through cross validation on the training data?

4 vues (au cours des 30 derniers jours)
Yuvaraj Rajamanickam
Yuvaraj Rajamanickam le 4 Jan 2017
Commenté : Jessica Schrouff le 15 Août 2018
Hi all...I have raw EEG data of size ( 1025 x 1 ) .Out of that I used data of size (820 x 1) for training and remaining (205 x 1) for testing. Now I want a find a threshold (varied b/w 0.1:0.1:1) by obtaining ROC through cross validation (5-fold) on the training data. How to obtain a ROC curve through cross validation on the training data? Find the code below:
threshold = 0.1:0.1:1;; numfolds = 5;
for ithreshold = 1:length(threshold);
cv = cvpartition(train_data,'Kfold',numfolds);
%cvFolds = crossvalind('Kfold',train_data,numfolds);
for ifold = 1:numfolds;
trIdx = cv.training(ifold);teIdx = cv.test(ifold);
train_data = norm_temp(trIdx,:);test_data = norm_temp(teIdx,:);
[tpr,fpr,ithreshold] = roc(train_data,teIdx);

Réponses (1)

Mudambi Srivatsa
Mudambi Srivatsa le 9 Jan 2017
In Statistics Toolbox, [X,Y] = perfcurve(labels,scores,posclass) computes a ROC curve for a vector of classifier predictions scores given the true class labels.
For more information on the "perfcurve" function, refer to the following link:
The following links provide some examples of using "perfcurve" function:
  1 commentaire
Jessica Schrouff
Jessica Schrouff le 15 Août 2018
How do people do when they do not have the statistics toolbox? I'm trying to use the interpolation as scikit-learn does, but an error is thrown:
Error using griddedInterpolant
The grid vectors must contain unique points.
The only solution for this error was to do a unique, but quite a few points of the curve would be lost. It would also tend to be under-estimating as it would take only the first occurrence of each x.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by