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
Best Answer