How to manually compute proportions of 1s using k nearest neighbors in R? Hello Dr. Ballings,
Can you explain the best approach to take to manually
compute proportions of 1s using k nearest neighbors in R?
In class, we computed the proportions using the
FNN package, so I'm uncertain of how to begin the process
w/o using the FNN package.
Answers and follow-up questions Answer or follow-up question 1
The steps are outlined in the first 10 sentences of Section 2.5.5.
For each new instance:
1. compute the dissimilarity with all training samples
2. take the k least dissimilar training samples
3. take the y of the training samples selected in step 2
4. compute the percentage of 1s in the vector obtained in step 3.
Michel BallingsSign in to be able to add an answer or mark this question as resolved.