I'm doing a KNN on the Employee Attrition dataset and I have installed gmodels package, but I still can't get the crosstable (see PrtSc).
This is what I did:
cl = Leaver_train[,1]
Leaver_train_pred <- knn(train = Leaver_train, test = Leaver_train, cl, k=25)
Leaver_test_pred <- knn(train = Leaver_train, test = Leaver_test, cl, k=25)
Error in CrossTable(x = Leaver_train_labels, y = Leaver_train_pred, prop.chisq = FALSE) :
x and y must have the same length
Any one an idea how to fix this?
Thanks in advance