Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Question concernig K-nearest neighbour classifier

Hi there,
 
Currently I'm comparing the new NI-classifiers to our own ones. Works quite fine for Nearest Neighbour & Minimum Mean Distance, but I can't figure out how to train the custom K.Nearest Neighbour classifier since I always get "The k parameter must be <= the the number of samples" error message. Finding k best scores of course assumes at least k samples in each class which is valid for the training data set attached (3 classes, 7,15,4 samples, k = 3). Increasing the number of samples does not solve the error returned by K-NN.
Is there some internal PCA or eigenvector analysis done that probably removes redundant data/feature vectors? NN and MMD show the correct number of samples (same as input) in each class in the training results, and besides that there is nothing written about data/feature space minimization in the concepts manual...
Attached is a code snipped for training and training data.
 
Any hints?
 
Thx, MArc

Message Edited by (void*)marc on 07-26-2005 03:40 AM

0 Kudos
Message 1 of 3
(3,255 Views)
Marc,

I believe the answer is much simpler than what you suspect. You have the train VI inside your for loop, so it is returning an error during the first iteration. Try this vi instead.

Kevin C.
National Instruments
Vision Software

Message Edited by KevinC on 07-26-2005 11:29 AM

0 Kudos
Message 2 of 3
(3,242 Views)

Hi Kevin,

Mhm, that makes sense ... seems I just got stuck in a not-to-understand-loop : )

Thanks a lot.

Marc

 

 

0 Kudos
Message 3 of 3
(3,225 Views)