0

Good day

I'm getting and error trying to fit a KNN model. I created a test and train dataset as follows:

train <- bank_norm[1:32950, ]
test <- bank_norm[32951:41188, ]
train_labels <- bank[1:32950, 1]
bpredict <- knn(train, test, train_labels, 203)

To replicate, the two files are on this link: [Box Folder with two datasets to replicate][1]

bank <- read_csv("~/R/bank.csv")
bank_norm <- read_csv("~/R/bank_norm.csv")

then execute the code to create train and test and fit the model. Any idea what could be wrong? Thanks in advance.

  • Please add minimal reproducible example while asking question. Have a look at https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – MKR Mar 11 '18 at 07:38
  • There are many different implementations of knn. Which one are you using? Please include your `library` statement in your code. – G5W Mar 11 '18 at 11:28

0 Answers0