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

3 次查看(过去 30 天)
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);

回答(1 个)

Mudambi Srivatsa
Mudambi Srivatsa 2017-1-9
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 个评论
Jessica Schrouff
Jessica Schrouff 2018-8-15
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 ROC - AUC 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by