Question: 2 . 2 . sample run 3 What is the patient's ID: 2 0 0 Majority vote from 5 nearest neighbors: Positive Actually this patient

2.2. sample run 3
What is the patient's ID: 200
Majority vote from 5 nearest neighbors: Positive
Actually this patient is tested: Negative. Step 2: Run over all patients and check the overall accuracy for \(\mathrm{k}=10\)
Based on what you have in step 1, you need to run a loop to check every patient's prediction vs actual diagnosis. Then find the accuracy (total number of correct predictions/total cases)
\# (5 points) for any given \( k \), for example \( k=10\),
\# loop over all patients then find the accuracy Step 3: Find the best k.
For different K, this accuracy might not be the same. Find the best K which corresponds the highest accuracy.
16]: \# (5 points) loop for different k: from 1 to 50(this loop will take 3-5 minutes)
\# find the best \( k \) which corresponds the highest accuracy
Best k: 5 The max. accuracy 0.8283828382838284
3.2. plotting (optional for you)
17]: \# (0 points) plotting 3.2. plotting (optional for you)
(5 points) comparison: with/without data scaling:
- rerun your code if you skipped the step of data scaling in the beginning.
- what are the differences?
2 . 2 . sample run 3 What is the patient's ID: 2

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!