Is it always possible to find a one-class SVM with given true positive rate (TPR)? I used 1-D grid search with cross-validation to find the width parameter of RBF kernel with .90 TPR. The closest model I found has average .79 TPR using cross-validation. I am not talking about the prediction on unseen data yet; just the cross-validation performance. Using the code below I find bestcv = 0.79 but I want a one-class SVM with near 0.9 bestcv!

% Each row of X contains a signals (has N rows), Row vector labs is
% vector of N ones, '-s 2' means one-class SVM, '-t 2' means RBF kernel
% which g is its parameter of. '-v 5' means use 5-fold cross-validation. libsvm-3.22 syntax

bestdif = inf; tpr = 0.9;
for log2g = -50:.125:10

cmd = ['-t 2 -s 2 -g ' num2str(2^log2g) ' -v ' 5];
cv = svmtrain(labs, X, cmd);
dif = abs(cv-tpr);
if dif <= bestdif

 bestdif = dif;  
 bestg   = 2^log2g;  
 bestcv  = cv;  


  • $\begingroup$ Could you describe your procedure in greater detail? From your description I do not understand what you were doing and why? $\endgroup$ – Tim Nov 17 '17 at 8:43
  • $\begingroup$ @tim I added details ... $\endgroup$ – Seeda Nov 17 '17 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.