covartech / PRT

Pattern Recognition Toolbox for MATLAB
http://covartech.github.io/
MIT License
145 stars 70 forks source link

prtDecisionMap #37

Closed anaritam closed 9 years ago

anaritam commented 9 years ago

What's the difference between

classifier = prtClassKnn + prtDecisionMap;

and

classifier = prtClassKnn; classifier.internalDecider= prtDecisionMap; ???

Because I'm getting very different results in terms of classification between this 2...

Thanks

kennethmorton commented 9 years ago

The following test code obtains the same results from both methods. Internal deciders are primarily used for plotting decision boundaries in an easy way. In almost all other cases it is preferable to use the + operator to form an algorithm.

I suspect your output mismatch is caused by other differences in the code.

Kenny

ds = prtDataGenMarysSimpleSixClass;

classifierPlusDecider = prtClassKnn + prtDecisionMap;
classifierInternalDecider = prtClassKnn('internalDecider',prtDecisionMap);

trainedPlus = train(classifierPlusDecider, ds);
trainedInternal = train(classifierInternalDecider, ds);

outPlus = run(trainedPlus, ds);
outInternal = run(trainedInternal, ds);

plot(1:outPlus.nObservations,outPlus.X,1:outInternal.nObservations,outInternal.X)
isequal(outPlus.X,outInternal.X) % Yields true