Question: One of the problems with k - nearest neighbor learning is selecting a value for k . For this exercise, you will empirically determine a

One of the problems with k-nearest neighbor learning is selecting a value for k. For this exercise, you will empirically determine a reasonable value for k, given a specific training set. Say you are given the data set shown below. This is a binary classification task in which the instances are described by two real-valued attributes.
a) Find a value of k (using *....., Matlab, o.) that minimizes leave-one-out crossvalidation error. What we'll be doing here is using our training set to help us select a good value for k . We take our training instances and divide them into two groups, so that some are used for training and others serve as validation (i.e., "test") examples. Specifically, for the given training set of 14 examples, we divide it into a set of 13 for training and a set of 1 for testing. There are obviously 14 ways to choose 13(i.e., "leave one out"), and we will consider all 14.
For each training-validation split of the data (remember that there are 14 of these), we run the k -nearest neighbor algorithm for all possible values of to 13). We then compute how well we did at classifying the validation instances for each value of k . The k that performs best is selected as the value to use for future (unseen) test instances. the K number should be odd
One of the problems with k - nearest neighbor

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!