Leo Jweda
Leo Jweda

Reputation: 2487

Creating a classifier in MATLAB to be used with classperf

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.

Upvotes: 1

Views: 2078

Answers (1)

Pete
Pete

Reputation: 2344

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)

Upvotes: 1

Related Questions