Okay in Python we can also create a KNN classifier. If we want to predict a categorical variable we'll create our K neighbors classifier here we want to predict or those are numeric variable, we can import this attaining attainable requests are here. So for classification, so we have to employ all these k neighbor classifier from SK learn dot neighbors. Okay, so how do I create a models so I can create some t 90s model equal k neighbor? A neighbor cross c fire okay then set the neighbors to some tea lie Okay neighbors to maybe around our tree them border of the x train and y train okay there we are we can do prediction using something like this or the dot p d s s tests okay. And I have to pre my prediction even though there will be nothing to play and then to know the body bodies si have changed to minus one in why I have to to four, so minus one that means I'm going to need the first variable the second variable variable.
So minus one. So, I will take the first four variable and then four is our data fee variable, so 01234 Okay. So, that is why and then I trained I create a training set and testing set. So, training set is around 80% testing set is around 20%. So as train why train as test and then White House and then this is the Model Model equal k neighbor classifier, the number of neighbors is tree and then model dot feed, training set S train y train prediction, model dot predict as test. So, I print a prediction and I run this code can get a prediction something like this