knncFuzzy
Fuzzy k-nearest neighbor classifier
Contents
Syntax
- testOut = knncFuzzy(testSet, trainSet, opt)
Description
testOut = knncFuzzy(testSet, trainSet, opt) returns the result of fuzzy KNN classifier, using the given training set trainSet and test set testSet.
References
- [1] J. M. Keller, M. R. Gray, and J. A. Givens, Jr., "A Fuzzy
- K-Nearest Neighbor Algorithm", IEEE Transactions on Systems,
- Man, and Cybernetics, Vol. 15, No. 4, pp. 580-585, 1985.
Example
[trainSet, testSet]=prData('3classes'); opt=knncFuzzy('defaultOpt'); opt.k=5; opt.m=2; [fuzzyOutput, crispOutput]=knncFuzzy(testSet, trainSet, opt, 1); fprintf('Recog. rate = %.2f%%\n', 100*sum(crispOutput==testSet.output)/length(testSet.output));
Recog. rate = 88.00%