How to obtain a ROC curve through cross validation on the training data?
1 回表示 (過去 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);
0 件のコメント
回答 (1 件)
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
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 Center および File Exchange で ROC - AUC についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!