I am trying to compare linear regression and regression using R.Below is my code for reg using knn:
library(caTools) set.seed(88) split=sample.split(sales_store,SplitRatio = 0.6) train=subset(sales_store,split==T) test=subset(sales_store,split==F) #Regression using kNN: fit <- knnreg(Sales ~ DayOfWeek+Customers+Open+Promo+StateHoliday+SchoolHoliday+Assortment+CompetitionDistance,data = train, k = 11,na.action = na.omit) knnPredict <- predict(fit,newdata = na.omit(test))
However I am getting an error:
how do I correct this error and see the results of predict?
Also,in linear regression we get the coefficients,R-Sq etc.
Is there something similar in knnreg which I can use to see how strong this regression is??