Plotting ROC for fitcecoc svm classifier

4 ビュー (過去 30 日間)
Roohollah Milimonfared
Roohollah Milimonfared 2017 年 10 月 14 日
コメント済み: SI LIU 2021 年 4 月 27 日
Hi I have created a 4 level SVM classifier by fitcecoc. I need to generate ROC curve for each class. This is the code: template = templateSVM('KernelFunction', 'gaussian', 'PolynomialOrder', [], ... 'KernelScale', 1, 'BoxConstraint', 1, 'Standardize', true);
[classificationSVM,HyperparameterOptimizationResults] = fitcecoc(predictors... , response, 'Learners', template, 'Coding', 'onevsone', 'OptimizeHyperparameters',... {'BoxConstraint','KernelScale'},'HyperparameterOptimizationOptions',... struct('AcquisitionFunctionName', 'expected-improvement-plus',... 'Repartition',true,'MaxObjectiveEvaluations',10,'kfold',5),'Verbose',0,... 'FitPosterior',1);
[label,NegLoss,PBScore,Posterior] = resubPredict(classificationSVM);
Apparently, I need to use perfcurve function to get the ROC. Yet, the help instructions are for fitcsvm that does not work for fitcecoc. I am trying to use the following code for class 1: [Xsvm,Ysvm,Tsvm,AUCsvm] = perfcurve(response,Posterior(:,1),'true'); Yet, I receive the below error message: Error using perfcurve>membership (line 693) Positive class is not found in the input data.
Error in perfcurve (line 437) [W,subYnames] = membership(cls(sorted),weights(sorted),... I was wondering how I can proceed from here.
Thanks, Roohollah
  1 件のコメント
SI LIU
SI LIU 2021 年 4 月 27 日
Undefined function 'Posterior' for input arguments of type 'ClassificationECOC'.

サインインしてコメントする。

採用された回答

Prashant Arora
Prashant Arora 2017 年 10 月 18 日
Hi Roohollah,
The reason you are getting this error because you defined the positive class to be "true" in the perfcurve function. This only work if the labels are logical values, i.e. can be defined as "true" or "False". If your labels are not logical values, you must define the Positive class as one of the member of the labels. You can find more information about this at the following link:
Hope this helps!
Prashant
  2 件のコメント
Roohollah Milimonfared
Roohollah Milimonfared 2017 年 10 月 23 日
Thanks Prashant. I was wondering if there is any standard procedure to generate ROC plots for multi-level classifiers. I am using one-vs-one coding design for the binary learners. Does that mean I have to use purcurve function for each binary learner separately? Thanks.
satinder nagra
satinder nagra 2020 年 2 月 11 日
may be, you are correct

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by