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 knearest neighbor learning is selecting a value for k For this exercise, you will empirically determine a reasonable value for 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 realvalued attributes.
a Find a value of k using Matlab, o that minimizes leaveoneout 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 ie "test" examples. Specifically, for the given training set of examples, we divide it into a set of for training and a set of for testing. There are obviously ways to choose ie "leave one out" and we will consider all
For each trainingvalidation split of the data remember that there are of these we run the k nearest neighbor algorithm for all possible values of to 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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
