KNN Algorithm Problem

How can KNN be used in the regression. Please give me an idea about what will be the labels and how many labels will be there?

Hello @Management718,

KNN is an algorithm that looks for the closest k similar instances of a test entity and makes a predicition using them. This is based on a intuition of ours that, similar objects tend to be closer in linear spaces.

In classification, we do a voting of the k nearest neighbours. And the class which is the most occuring in them is our predicition

Similarly, in regression, the only change is that rather than doing a voting, we take the mean of the y of the k nearest neighbours. The mean is then our prediction.

Happy Learning :slight_smile:
Thanks

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.