@Rohit_Nair wrote:
I am getting this error when i m trying to run knn algorithm. There are no missing values .I imputed them with -1. Still its giving me this error. Can anyone help me out with this error
train <- read.csv("train.csv")
total var = 128train <- train[-1] #Since 1st one was Id
Created parition
ind <- createDataPartition(train$Response, p=0.70, list=FALSE)
dat_train <- train[ ind,-127] #leave your target variable out
dat_test <- train[-ind,-127] #leave your target variable out
cl<-train[ind,127] #your target variable for the train set
knn (dat_train, dat_test, cl, k=5, prob=TRUE)Error in knn(train = prc_train, test = prc_test, cl = prc_train_labels, :
NA/NaN/Inf in foreign function call (arg 6)
In addition: Warning messages:
1: In knn(train = prc_train, test = prc_test, cl = prc_train_labels, :
NAs introduced by coercion
2: In knn(train = prc_train, test = prc_test, cl = prc_train_labels, :
NAs introduced by coercion@shuvayan @Lesaffrea @Aarshay Can you help me with this.
Posts: 1
Participants: 1