# Pattern classification: what goes into the sample?

I am trying to compare the performance of a classification result with Bayes classifier, K-NN, Piece wise component analysis (PCA). I have doubts regarding the following (please excuse my lack of programming skills since I am a biologist and not a programmer thus finding the Matlab documentation hard to follow).

In the Matlab code

    Class = knnclassify(Sample, Training, Group, k)
Group =  [1;2;3]   //where 1,2,3 represents Class A,B,C respectively.


What goes in the sample because my data is a 100 row 1 column for each of the classes? So Group 1 contains data like $[0.9;0.1;......n]$ where $n=100$. Would the sample be a vector containing random mixtures of the data points from the three classes? Same question for the Training matrix.

• This looks like four questions in one. I edited all but the first question; please post the others separately. With respect to your second question, more details would help: what do you understand so far and what is stumping you? – Gilles Apr 2 '12 at 8:38
• You need to be more specific. Sample should be data you need to classify and training data is the learned data with group labels. See K-Nearest-Neighbor algorithm here: k-nn – Strin Apr 2 '12 at 15:31

That being said, "Training" should contain the feature vectors of your labeled dataset (probably 1 record per row). "Group" contains the class label for the corresponding record. So the $i^{th}$ value in Group is the class label associated with the $i^{th}$ record in "Training". "K" specifies the number of neighbors you'd like to look at when classifying new objects. Lastly, "Sample" will be the data point you want to classify.