Nearest Neighbour Classifier
In this post, I am explaining a very simple and basic classification algorithm called as the KNN algorithm i.e the K-nearest neighbor algorithm. Suppose you are trying to predict for a binary classification problem. You would be having a pre-defined train data set. The Nearest Neighbour algorithm is different from all the other classification algorithms. It doesn't involve model building or function formation from the given train dataset as the other classification algorithm do. Instead, it memorizes the training data. It will become clear with an example. Suppose I have to classify the sentiment of a given sentence whether the given sentence is positive or negative. We have our initial data set (or training set) : Text1 I love this movie. Category: Positive Text2: I hate this phone. Category: Negative. After removing the stop words(the words which are of no use when it comes to classification ) I am left with : Text1: loved, movie Text2: hate, phone Af...