#Acho que faltou voce importar os dados, vamos lembrar abaixo usando o pandas:
import pandas as pd
In place of the one in quotes you place your dataframe with the path where it is
df = pd.read_csv('Data/your.csv file')
Separating here what will be used to predict and what will be used as a class or the teacher
previsors = df.iloc[:,0:4]. values
class = df.iloc[:,4]. values
Now yes I will separate here the test data and training data
from sklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test = train_test_split(predictors,classes, test_size = 0.25, random_state=0)
Now I’m going to import the Knn algorithm you’re using
from sklearn.Neighbors import Kneighborsclassifier
I define here some hyperparameters
classifier = Kneighborsclassifier(n_neighbors=5, Metric='Minkowski', p=2)
I train the model
classifier.fit(X_train, y_train)
I test the model with my test base, to see if the model is good
predictions = classifier.Predict(X_test)
And now I’m gonna check to see if you’re okay with some metrics
from sklearn.Metrics import confusion_matrix, accuracy_score
accuracy_score(X_test, y_test)
matrix = confusion_matrix(X_test, y_test)