1

I'm working on a new model and would like to use classperf to check the performance of my classifier. How do I make it use my classifier as opposed to one of the built-in ones? All the examples I found online use classifiers that are included in MATLAB. I want to use K-fold to test it.

Has QUIT--Anony-Mousse
  • 76,138
  • 12
  • 138
  • 194
Leo Jweda
  • 2,481
  • 3
  • 23
  • 34

1 Answers1

1

It isn't clear form the MATLAB documentation how to do this, though you can edit functions like knnclassify or svmclassify to see how they were written, and try to emulate that functionality.

Alternatively, there's a free MATLAB pattern recognition toolbox that uses objects to represent classifiers:

http://www.mathworks.com/matlabcentral/linkexchange/links/2947-pattern-recognition-toolbox

And you can make a new classifier by sub-classing the base classifier object: prtClass.

Then you can do:

c = myClassifier; yGuess = c.kfolds(dataSet,10); %10 fold X-val

(Full disclosure, I'm an author of the PRT toolbox)

Pete
  • 2,336
  • 2
  • 16
  • 23
  • I will try to see how those functions are written, failing that I'll use PRT, it sounds like an interesting toolbox anyway. How can I use that classifier with classperf after I create it? – Leo Jweda Nov 21 '12 at 13:53
  • The PRT classifiers are not usable with classperf. You can use kfolds, crossValidate, and other PRT functions to evaluate prt classifiers. It doesn't seem like classperf was written to easily enable anyone to use new classifiers... or at least I can't find the Doc – Pete Nov 21 '12 at 16:18